This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2022-11-28 14:23:13 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-11-29 00:15:52 -08:00
|
|
|
class UnreactService < BaseService
|
2022-11-28 14:23:13 -08:00
|
|
|
include Payloadable
|
|
|
|
|
|
|
|
def call(account, status)
|
|
|
|
reaction = StatusReaction.find_by(account: account, status: status)
|
|
|
|
return if reaction.nil?
|
|
|
|
|
|
|
|
reaction.destroy!
|
|
|
|
|
|
|
|
json = Oj.dump(serialize_payload(reaction, ActivityPub::UndoEmojiReactionSerializer))
|
|
|
|
if status.account.local?
|
|
|
|
ActivityPub::RawDistributionWorker.perform_async(json, status.account.id)
|
|
|
|
else
|
|
|
|
ActivityPub::DeliveryWorker.perform_async(json, reaction.account_id, status.account.inbox_url)
|
|
|
|
end
|
|
|
|
|
|
|
|
reaction
|
|
|
|
end
|
|
|
|
end
|