diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/activitypub/fetch_featured_collection_service.rb | 2 | ||||
-rw-r--r-- | app/services/remove_status_service.rb | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/services/activitypub/fetch_featured_collection_service.rb b/app/services/activitypub/fetch_featured_collection_service.rb index 9fce478c1..780741feb 100644 --- a/app/services/activitypub/fetch_featured_collection_service.rb +++ b/app/services/activitypub/fetch_featured_collection_service.rb @@ -48,6 +48,6 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService end def local_follower - @local_follower ||= account.followers.local.without_suspended.first + @local_follower ||= @account.followers.local.without_suspended.first end end diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 9259c69d9..2fe3bab5c 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -9,6 +9,7 @@ class RemoveStatusService < BaseService # @param [Hash] options # @option [Boolean] :redraft # @option [Boolean] :immediate + # @option [Boolean] :preserve # @option [Boolean] :original_removed def call(status, **options) @payload = Oj.dump(event: :delete, payload: status.id.to_s) @@ -44,7 +45,7 @@ class RemoveStatusService < BaseService remove_media end - @status.destroy! if @options[:immediate] || !@status.reported? + @status.destroy! if permanently? else raise Mastodon::RaceConditionError end @@ -143,11 +144,15 @@ class RemoveStatusService < BaseService end def remove_media - return if @options[:redraft] || (!@options[:immediate] && @status.reported?) + return if @options[:redraft] || !permanently? @status.media_attachments.destroy_all end + def permanently? + @options[:immediate] || !(@options[:preserve] || @status.reported?) + end + def lock_options { redis: Redis.current, key: "distribute:#{@status.id}", autorelease: 5.minutes.seconds } end |