Merge remote-tracking branch 'remotes/origin/develop' into 1505-threads-federation
This commit is contained in:
commit
4e6bbdc7b5
76 changed files with 987 additions and 363 deletions
|
|
@ -586,7 +586,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
"star" => "⭐"
|
||||
}
|
||||
|
||||
@doc "Rewrite misskey likes into EmojiReactions"
|
||||
@doc "Rewrite misskey likes into EmojiReacts"
|
||||
def handle_incoming(
|
||||
%{
|
||||
"type" => "Like",
|
||||
|
|
@ -595,7 +595,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
options
|
||||
) do
|
||||
data
|
||||
|> Map.put("type", "EmojiReaction")
|
||||
|> Map.put("type", "EmojiReact")
|
||||
|> Map.put("content", @misskey_reactions[reaction] || reaction)
|
||||
|> handle_incoming(options)
|
||||
end
|
||||
|
|
@ -616,7 +616,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
|
||||
def handle_incoming(
|
||||
%{
|
||||
"type" => "EmojiReaction",
|
||||
"type" => "EmojiReact",
|
||||
"object" => object_id,
|
||||
"actor" => _actor,
|
||||
"id" => id,
|
||||
|
|
@ -757,7 +757,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
def handle_incoming(
|
||||
%{
|
||||
"type" => "Undo",
|
||||
"object" => %{"type" => "EmojiReaction", "id" => reaction_activity_id},
|
||||
"object" => %{"type" => "EmojiReact", "id" => reaction_activity_id},
|
||||
"actor" => _actor,
|
||||
"id" => id
|
||||
} = data,
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
|
||||
def make_emoji_reaction_data(user, object, emoji, activity_id) do
|
||||
make_like_data(user, object, activity_id)
|
||||
|> Map.put("type", "EmojiReaction")
|
||||
|> Map.put("type", "EmojiReact")
|
||||
|> Map.put("content", emoji)
|
||||
end
|
||||
|
||||
|
|
@ -490,10 +490,19 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
|> Repo.one()
|
||||
end
|
||||
|
||||
def fetch_latest_undo(%User{ap_id: ap_id}) do
|
||||
"Undo"
|
||||
|> Activity.Queries.by_type()
|
||||
|> where(actor: ^ap_id)
|
||||
|> order_by([activity], fragment("? desc nulls last", activity.id))
|
||||
|> limit(1)
|
||||
|> 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"
|
||||
"EmojiReact"
|
||||
|> Activity.Queries.by_type()
|
||||
|> where(actor: ^ap_id)
|
||||
|> where([activity], fragment("?->>'content' = ?", activity.data, ^emoji))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue