Handle Undo from Misskey

Right now Misskey users were able to react, but couldn't remove their reactions.
delegates `Undo` for a `Like` to `undo_emoji_react` when there is no favourite found.

(Misskey `Like` activities can still create a fav when the emoji tag is invalid, I don't see the point though)

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
This commit is contained in:
Plastikmensch 2023-05-14 23:59:56 +02:00 committed by Jeremy Kescher
parent 8cecb468b0
commit f9730eba77
No known key found for this signature in database
GPG key ID: 80A419A7A613DFA4

View file

@ -110,13 +110,15 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
if @account.favourited?(status)
favourite = status.favourites.where(account: @account).first
favourite&.destroy
elsif @object['_misskey_reaction'].present?
undo_emoji_react
else
delete_later!(object_uri)
end
end
def undo_emoji_react
name = @object['content']
name = @object['content'] || @object['_misskey_reaction']
tags = @object['tag']
return if name.nil?