about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/activitypub/process_account_service.rb1
-rw-r--r--app/services/batched_remove_status_service.rb2
-rw-r--r--app/services/post_status_service.rb8
-rw-r--r--app/services/remove_status_service.rb12
-rw-r--r--app/services/suspend_account_service.rb1
5 files changed, 22 insertions, 2 deletions
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 603e27ed9..cef658e19 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -83,6 +83,7 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.fields                  = property_values || {}
     @account.also_known_as           = as_array(@json['alsoKnownAs'] || []).map { |item| value_or_id(item) }
     @account.actor_type              = actor_type
+    @account.discoverable            = @json['discoverable'] || false
   end
 
   def set_fetchable_attributes!
diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb
index c9a9a5a6e..31237337a 100644
--- a/app/services/batched_remove_status_service.rb
+++ b/app/services/batched_remove_status_service.rb
@@ -8,7 +8,7 @@ class BatchedRemoveStatusService < BaseService
   # Dispatch Salmon deletes, unique per domain, of the deleted statuses, but only local ones
   # Remove statuses from home feeds
   # Push delete events to streaming API for home feeds and public feeds
-  # @param [Status] statuses A preferably batched array of statuses
+  # @param [Enumerable<Status>] statuses A preferably batched array of statuses
   # @param [Hash] options
   # @option [Boolean] :skip_side_effects
   def call(statuses, **options)
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index b36471339..5d17f111b 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -49,7 +49,13 @@ class PostStatusService < BaseService
   def preprocess_attributes!
     if @text.blank? && @options[:spoiler_text].present?
      @text = '.'
-     @text = @media.find(&:video?) ? '📹' : '🖼' if @media.size > 0
+     if @media.find(&:video?) || @media.find(&:gifv?)
+       @text = '📹'
+     elsif @media.find(&:audio?)
+       @text = '🎵'
+     elsif @media.find(&:image?)
+       @text = '🖼'
+     end
     end
     @visibility   = @options[:visibility] || @account.user&.setting_default_privacy
     @visibility   = :unlisted if @visibility == :public && @account.silenced?
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index c19fa2126..b2f712089 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -4,6 +4,11 @@ class RemoveStatusService < BaseService
   include Redisable
   include Payloadable
 
+  # Delete a status
+  # @param   [Status] status
+  # @param   [Hash] options
+  # @option  [Boolean] :redraft
+  # @options [Boolean] :original_removed
   def call(status, **options)
     @payload  = Oj.dump(event: :delete, payload: status.id.to_s)
     @status   = status
@@ -25,6 +30,7 @@ class RemoveStatusService < BaseService
         remove_from_media if status.media_attachments.any?
         remove_from_direct if status.direct_visibility?
         remove_from_spam_check
+        remove_media
 
         @status.destroy!
       else
@@ -151,6 +157,12 @@ class RemoveStatusService < BaseService
     end
   end
 
+  def remove_media
+    return if @options[:redraft]
+
+    @status.media_attachments.destroy_all
+  end
+
   def remove_from_spam_check
     redis.zremrangebyscore("spam_check:#{@status.account_id}", @status.id, @status.id)
   end
diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb
index 902af376c..85da7e921 100644
--- a/app/services/suspend_account_service.rb
+++ b/app/services/suspend_account_service.rb
@@ -61,6 +61,7 @@ class SuspendAccountService < BaseService
     return if !@account.local? || @account.user.nil?
 
     if @options[:including_user]
+      @options[:destroy] = true if !@account.user_confirmed? || @account.user_pending?
       @account.user.destroy
     else
       @account.user.disable!