Add notifications for statuses deleted by moderators (#17204)
This commit is contained in:
parent
d5c9feb7b7
commit
14f436c457
59 changed files with 1220 additions and 598 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue