diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-01-17 09:41:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 09:41:33 +0100 |
commit | 14f436c457560862fafabd753eb314c8b8a8e674 (patch) | |
tree | 905e62fd68c52efc9eec5b63d7170eee0c0c93a7 /app/services | |
parent | d5c9feb7b7fc489afbd0a287431fe07b42451ef0 (diff) |
Add notifications for statuses deleted by moderators (#17204)
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/remove_status_service.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index f9c3dcf78..3535b503b 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) @@ -43,7 +44,7 @@ class RemoveStatusService < BaseService remove_media end - @status.destroy! if @options[:immediate] || !@status.reported? + @status.destroy! if permanently? else raise Mastodon::RaceConditionError end @@ -135,11 +136,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 |