1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-15 23:28:31 +09:00

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 03845b0be2
commit 63facd7c8e
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) if @account.favourited?(status)
favourite = status.favourites.where(account: @account).first favourite = status.favourites.where(account: @account).first
favourite&.destroy favourite&.destroy
elsif @object['_misskey_reaction'].present?
undo_emoji_react
else else
delete_later!(object_uri) delete_later!(object_uri)
end end
end end
def undo_emoji_react def undo_emoji_react
name = @object['content'] name = @object['content'] || @object['_misskey_reaction']
tags = @object['tag'] tags = @object['tag']
return if name.nil? return if name.nil?