diff options
author | Ekaterina Vaartis <vaartis@cock.li> | 2019-04-18 21:17:52 +0300 |
---|---|---|
committer | Ekaterina Vaartis <vaartis@cock.li> | 2019-04-20 11:17:17 +0300 |
commit | 52ed287e87ea18fdbf14695ccfafae00768299dc (patch) | |
tree | 17a6795bbbdc1f0963291cfbec7c19f01ab182de /lib | |
parent | 9bd5e2dec9ce0b23f287b3ea6ad375280d92bb7b (diff) | |
download | pleroma-52ed287e87ea18fdbf14695ccfafae00768299dc.tar.gz |
Fix incorrect multiple emoji tag handling introduced in initial impl
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/emoji.ex | 13 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/twitter_api/controllers/util_controller.ex | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex index 9a23bd81b..15455b779 100644 --- a/lib/pleroma/emoji.ex +++ b/lib/pleroma/emoji.ex @@ -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 diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 3916d7c41..2a81dcc67 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -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 diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 9441984c7..8665e058a 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -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(%{}) |