mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-23 05:18:06 +01:00
handle misskey reactions properly
misskey federates emoji reactions as likes.
This commit is contained in:
parent
8398f7ad4e
commit
758f9f6384
2 changed files with 16 additions and 2 deletions
|
@ -9,6 +9,8 @@ class ActivityPub::Activity::EmojiReact < ActivityPub::Activity
|
||||||
delete_arrived_first?(@json['id']) ||
|
delete_arrived_first?(@json['id']) ||
|
||||||
@account.reacted?(original_status, name)
|
@account.reacted?(original_status, name)
|
||||||
|
|
||||||
original_status.status_reactions.create!(account: @account, name: name)
|
reaction = original_status.status_reactions.create!(account: @account, name: name)
|
||||||
|
|
||||||
|
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,8 +3,20 @@
|
||||||
class ActivityPub::Activity::Like < ActivityPub::Activity
|
class ActivityPub::Activity::Like < ActivityPub::Activity
|
||||||
def perform
|
def perform
|
||||||
original_status = status_from_uri(object_uri)
|
original_status = status_from_uri(object_uri)
|
||||||
|
return if original_status.nil? || !original_status.account.local? || delete_arrived_first?(@json['id'])
|
||||||
|
|
||||||
return if original_status.nil? || !original_status.account.local? || delete_arrived_first?(@json['id']) || @account.favourited?(original_status)
|
# misskey delivers reactions as likes and attaches the emoji in _misskey_reaction
|
||||||
|
mk_reaction = @json['_misskey_reaction']
|
||||||
|
unless mk_reaction.nil?
|
||||||
|
custom_emoji = CustomEmoji.find_by(shortcode: mk_reaction, domain: @account.domain)
|
||||||
|
return if @account.reacted?(original_status, mk_reaction, custom_emoji)
|
||||||
|
|
||||||
|
reaction = original_status.status_reactions.create!(account: @account, name: mk_reaction, custom_emoji: custom_emoji)
|
||||||
|
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
return if @account.favourited?(original_status)
|
||||||
|
|
||||||
favourite = original_status.favourites.create!(account: @account)
|
favourite = original_status.favourites.create!(account: @account)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue