@ -4,6 +4,11 @@ class RemoveStatusService < BaseService
include Redisable
include Redisable
include Payloadable
include Payloadable
# Delete a status
# @param [Status] status
# @param [Hash] options
# @option [Boolean] :redraft
# @options [Boolean] :original_removed
def call ( status , ** options )
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
@ -24,6 +29,7 @@ class RemoveStatusService < BaseService
remove_from_public
remove_from_public
remove_from_media if status . media_attachments . any?
remove_from_media if status . media_attachments . any?
remove_from_spam_check
remove_from_spam_check
remove_media
@status . destroy!
@status . destroy!
else
else
@ -143,6 +149,12 @@ class RemoveStatusService < BaseService
redis . publish ( 'timeline:public:local:media' , @payload ) if @status . local?
redis . publish ( 'timeline:public:local:media' , @payload ) if @status . local?
end
end
def remove_media
return if @options [ :redraft ]
@status . media_attachments . destroy_all
end
def remove_from_spam_check
def remove_from_spam_check
redis . zremrangebyscore ( " spam_check: #{ @status . account_id } " , @status . id , @status . id )
redis . zremrangebyscore ( " spam_check: #{ @status . account_id } " , @status . id , @status . id )
end
end