1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-18 00:29:13 +09:00
YuruToot/app/lib/activitypub/activity/emoji_react.rb
fef 5230a2c7bc
federate emoji reactions
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.
2023-07-07 21:57:38 +02:00

15 lines
444 B
Ruby

# frozen_string_literal: true
class ActivityPub::Activity::EmojiReact < ActivityPub::Activity
def perform
original_status = status_from_uri(object_uri)
name = @json['content']
return if original_status.nil? ||
!original_status.account.local? ||
delete_arrived_first?(@json['id']) ||
@account.reacted?(original_status, name)
original_status.status_reactions.create!(account: @account, name: name)
end
end