@ -3,7 +3,7 @@
class RemoveStatusService < BaseService
class RemoveStatusService < BaseService
include StreamEntryRenderer
include StreamEntryRenderer
def call ( status )
def call ( status , options = { } )
@payload = Oj . dump ( event : :delete , payload : status . id . to_s )
@payload = Oj . dump ( event : :delete , payload : status . id . to_s )
@status = status
@status = status
@account = status . account
@account = status . account
@ -11,6 +11,7 @@ class RemoveStatusService < BaseService
@mentions = status . mentions . includes ( :account ) . to_a
@mentions = status . mentions . includes ( :account ) . to_a
@reblogs = status . reblogs . to_a
@reblogs = status . reblogs . to_a
@stream_entry = status . stream_entry
@stream_entry = status . stream_entry
@options = options
remove_from_self if status . account . local?
remove_from_self if status . account . local?
remove_from_followers
remove_from_followers
@ -22,7 +23,12 @@ class RemoveStatusService < BaseService
@status . destroy!
@status . destroy!
return unless @account . local?
# There is no reason to send out Undo activities when the
# cause is that the original object has been removed, since
# original object being removed implicitly removes reblogs
# of it. The Delete activity of the original is forwarded
# separately.
return if ! @account . local? || @options [ :original_removed ]
remove_from_remote_followers
remove_from_remote_followers
remove_from_remote_affected
remove_from_remote_affected
@ -104,7 +110,7 @@ class RemoveStatusService < BaseService
# without us being able to do all the fancy stuff
# without us being able to do all the fancy stuff
@reblogs . each do | reblog |
@reblogs . each do | reblog |
RemoveStatusService . new . call ( reblog )
RemoveStatusService . new . call ( reblog , original_removed : true )
end
end
end
end