Fix incorrect multiple emoji tag handling introduced in initial impl
This commit is contained in:
parent
9bd5e2dec9
commit
52ed287e87
@ -147,8 +147,7 @@ defmodule Pleroma.Emoji do
|
||||
|> Enum.map(fn {shortcode, rel_file} ->
|
||||
filename = Path.join(common_pack_path, rel_file)
|
||||
|
||||
# If no tag matches, use the pack name as a tag
|
||||
{shortcode, filename, to_string(match_extra(@groups, filename))}
|
||||
{shortcode, filename, [to_string(match_extra(@groups, filename))]}
|
||||
end)
|
||||
end
|
||||
end
|
||||
@ -190,11 +189,11 @@ defmodule Pleroma.Emoji do
|
||||
|> Stream.map(&String.trim/1)
|
||||
|> Stream.map(fn line ->
|
||||
case String.split(line, ~r/,\s*/) do
|
||||
[name, file, tags] ->
|
||||
{name, file, tags}
|
||||
|
||||
[name, file] ->
|
||||
{name, file, to_string(match_extra(@groups, file))}
|
||||
{name, file, [to_string(match_extra(@groups, file))]}
|
||||
|
||||
[name, file | tags] ->
|
||||
{name, file, tags}
|
||||
|
||||
_ ->
|
||||
nil
|
||||
@ -217,7 +216,7 @@ defmodule Pleroma.Emoji do
|
||||
tag = match_extra(@groups, Path.join("/", Path.relative_to(path, static_path)))
|
||||
shortcode = Path.basename(path, Path.extname(path))
|
||||
external_path = Path.join("/", Path.relative_to(path, static_path))
|
||||
{shortcode, external_path, to_string(tag)}
|
||||
{shortcode, external_path, [to_string(tag)]}
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -190,7 +190,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
||||
"static_url" => url,
|
||||
"visible_in_picker" => true,
|
||||
"url" => url,
|
||||
"tags" => String.split(tags, ",")
|
||||
"tags" => tags
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
@ -286,7 +286,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
||||
emoji =
|
||||
Emoji.get_all()
|
||||
|> Enum.map(fn {short_code, path, tags} ->
|
||||
{short_code, %{image_url: path, tags: String.split(tags, ",")}}
|
||||
{short_code, %{image_url: path, tags: tags}}
|
||||
end)
|
||||
|> Enum.into(%{})
|
||||
|
||||
|
@ -15,7 +15,7 @@ defmodule Pleroma.EmojiTest do
|
||||
assert tuple_size(emoji) == 3
|
||||
assert is_binary(code)
|
||||
assert is_binary(path)
|
||||
assert is_binary(tags)
|
||||
assert is_list(tags)
|
||||
end
|
||||
|
||||
test "random emoji", %{emoji_list: emoji_list} do
|
||||
@ -25,7 +25,7 @@ defmodule Pleroma.EmojiTest do
|
||||
assert tuple_size(emoji) == 3
|
||||
assert is_binary(code)
|
||||
assert is_binary(path)
|
||||
assert is_binary(tags)
|
||||
assert is_list(tags)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user