Emoji: Unify tag building, fix tests.

This commit is contained in:
Lain Soykaf 2026-01-05 11:57:38 +04:00
commit bac607c7c0
7 changed files with 22 additions and 29 deletions

View file

@ -189,6 +189,18 @@ defmodule Pleroma.Emoji do
def emoji_url(_), do: nil
def build_emoji_tag({name, url}) do
url = URI.encode(url)
%{
"icon" => %{"url" => "#{url}", "type" => "Image"},
"name" => ":" <> name <> ":",
"type" => "Emoji",
"updated" => "1970-01-01T00:00:00Z",
"id" => url
}
end
def emoji_name_with_instance(name, url) do
url = url |> URI.parse() |> Map.get(:host)
"#{name}@#{url}"