parent
8dd7daf5ee
commit
71f4281850
2 changed files with 21 additions and 6 deletions
|
@ -146,4 +146,23 @@ defmodule Pleroma.Emoji do
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_unicode_emoji?(_), do: false
|
def is_unicode_emoji?(_), do: false
|
||||||
|
|
||||||
|
def stripped_name(name) when is_binary(name) do
|
||||||
|
name
|
||||||
|
|> String.replace_leading(":", "")
|
||||||
|
|> String.replace_trailing(":", "")
|
||||||
|
end
|
||||||
|
|
||||||
|
def stripped_name(name), do: name
|
||||||
|
|
||||||
|
def maybe_quote(name) when is_binary(name) do
|
||||||
|
if is_unicode_emoji?(name) do
|
||||||
|
name
|
||||||
|
else
|
||||||
|
":#{name}:"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def maybe_quote(name), do: name
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -543,14 +543,10 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_latest_reaction(internal_activity_id, %{ap_id: ap_id}, emoji) do
|
def get_latest_reaction(internal_activity_id, %{ap_id: ap_id}, emoji) do
|
||||||
|
IO.inspect(emoji)
|
||||||
%{data: %{"object" => object_ap_id}} = Activity.get_by_id(internal_activity_id)
|
%{data: %{"object" => object_ap_id}} = Activity.get_by_id(internal_activity_id)
|
||||||
|
|
||||||
emoji =
|
emoji = Pleroma.Emoji.maybe_quote(emoji)
|
||||||
if String.starts_with?(emoji, ":") do
|
|
||||||
emoji
|
|
||||||
else
|
|
||||||
":#{emoji}:"
|
|
||||||
end
|
|
||||||
|
|
||||||
"EmojiReact"
|
"EmojiReact"
|
||||||
|> Activity.Queries.by_type()
|
|> Activity.Queries.by_type()
|
||||||
|
|
Loading…
Reference in a new issue