diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-08-29 12:07:50 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-08-29 12:07:50 +0200 |
commit | 48b8a1f414e3d8430bd797e3db298fc5355ace2d (patch) | |
tree | c7b84ed81fb99b51eb2596df8ac1663d1998fa89 /app/services | |
parent | 79725f659d5e9c449df0ff73f9363407a0a064bd (diff) | |
parent | 4500dc2385d8571c494ea0277fe4ca415a264404 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/models/status.rb - app/services/remove_status_service.rb - db/schema.rb All conflicts were due to the addition of a `deleted_at` attribute to Statuses and reworked database indexes.
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 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/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 |