mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 17:11:36 +01:00
support Undo action for EmojiReaction
This commit is contained in:
parent
8dcf7b224c
commit
e0607e36a9
1 changed files with 18 additions and 0 deletions
|
@ -11,6 +11,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
|
||||||
undo_follow
|
undo_follow
|
||||||
when 'Like'
|
when 'Like'
|
||||||
undo_like
|
undo_like
|
||||||
|
when 'EmojiReact'
|
||||||
|
undo_emoji_react
|
||||||
when 'Block'
|
when 'Block'
|
||||||
undo_block
|
undo_block
|
||||||
when nil
|
when nil
|
||||||
|
@ -113,6 +115,22 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def undo_emoji_react
|
||||||
|
name = @object['content']
|
||||||
|
return if name.nil?
|
||||||
|
|
||||||
|
status = status_from_uri(target_uri)
|
||||||
|
|
||||||
|
return if status.nil? || !status.account.local?
|
||||||
|
|
||||||
|
if @account.reacted?(status, name.delete(':'))
|
||||||
|
reaction = status.status_reactions.where(account: @account, name: name).first
|
||||||
|
reaction&.destroy
|
||||||
|
else
|
||||||
|
delete_later!(object_uri)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def undo_block
|
def undo_block
|
||||||
target_account = account_from_uri(target_uri)
|
target_account = account_from_uri(target_uri)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue