CommonAPI: Add unreactions.
This commit is contained in:
parent
dfe5c958eb
commit
9cfe9a57c5
3 changed files with 26 additions and 1 deletions
|
|
@ -452,6 +452,19 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
|> Repo.one()
|
||||
end
|
||||
|
||||
def get_latest_reaction(internal_activity_id, %{ap_id: ap_id}, emoji) do
|
||||
%{data: %{"object" => object_ap_id}} = Activity.get_by_id(internal_activity_id)
|
||||
|
||||
"EmojiReaction"
|
||||
|> Activity.Queries.by_type()
|
||||
|> where(actor: ^ap_id)
|
||||
|> where([activity], fragment("?->>'content' = ?", activity.data, ^emoji))
|
||||
|> Activity.Queries.by_object_id(object_ap_id)
|
||||
|> order_by([activity], fragment("? desc nulls last", activity.id))
|
||||
|> limit(1)
|
||||
|> Repo.one()
|
||||
end
|
||||
|
||||
#### Announce-related helpers
|
||||
|
||||
@doc """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue