mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 17:28:07 +01:00
cc71e734c4
this is kind of experimental, but it should work in theory. at least i tested it with a remove akkoma instance and it didn't crash.
21 lines
591 B
Ruby
21 lines
591 B
Ruby
# frozen_string_literal: true
|
|
|
|
class StatusUnreactionService < BaseService
|
|
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
|