diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/batched_remove_status_service.rb | 2 | ||||
-rw-r--r-- | app/services/remove_status_service.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index 09d094c15..7318831e7 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -6,7 +6,7 @@ class BatchedRemoveStatusService < BaseService # Delete given statuses and reblogs of them # 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/remove_status_service.rb b/app/services/remove_status_service.rb index 51d200361..42ae9591d 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -6,6 +6,11 @@ class RemoveStatusService < BaseService MIN_SCHEDULE_OFFSET = 60.seconds.freeze + # 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 @@ -29,6 +34,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 @@ -162,6 +168,12 @@ class RemoveStatusService < BaseService Redis.current.publish("timeline:direct:#{@account.id}", @payload) if @account.local? 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 |