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
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2022-11-28 21:21:53 -08:00
|
|
|
reaction = original_status.status_reactions.create!(account: @account, name: name)
|
|
|
|
|
|
|
|
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
2022-11-28 14:23:13 -08:00
|
|
|
end
|
|
|
|
end
|