diff options
author | rinpatch <rinpatch@sdf.org> | 2019-05-19 17:06:44 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-05-19 17:06:44 +0300 |
commit | 1d90f9b96999f8bad3fa3e3ec58bf50c8666be4f (patch) | |
tree | ee65841476114b17ad900650479b0824081100aa /lib/pleroma/web/common_api/utils.ex | |
parent | 5ece901af3e887664653c79c5e61618cc5cf0ecf (diff) | |
download | pleroma-1d90f9b96999f8bad3fa3e3ec58bf50c8666be4f.tar.gz |
Remove tags/mentions/rich text from poll options because Mastodon and
add custom emoji
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 2ea997789..cd8483c11 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -102,26 +102,15 @@ defmodule Pleroma.Web.CommonAPI.Utils do end end - def make_poll_data( - %{"poll" => %{"options" => options, "expires_in" => expires_in}} = data, - mentions, - tags - ) + def make_poll_data(%{"poll" => %{"options" => options, "expires_in" => expires_in}} = data) when is_list(options) and is_integer(expires_in) do - content_type = get_content_type(data["content_type"]) - # XXX: There is probably a more performant/cleaner way to do this - {poll, {mentions, tags}} = - Enum.map_reduce(options, {mentions, tags}, fn option, {mentions, tags} -> - # TODO: Custom emoji - {option, mentions_merge, tags_merge} = format_input(option, content_type) - mentions = mentions ++ mentions_merge - tags = tags ++ tags_merge - + {poll, emoji} = + Enum.map_reduce(options, %{}, fn option, emoji -> {%{ "name" => option, "type" => "Note", "replies" => %{"type" => "Collection", "totalItems" => 0} - }, {mentions, tags}} + }, Map.merge(emoji, Formatter.get_emoji_map(option))} end) end_time = @@ -136,11 +125,11 @@ defmodule Pleroma.Web.CommonAPI.Utils do %{"type" => "Question", "oneOf" => poll, "closed" => end_time} end - {poll, mentions, tags} + {poll, emoji} end - def make_poll_data(_data, mentions, tags) do - {%{}, mentions, tags} + def make_poll_data(_data) do + {%{}, %{}} end def make_content_html( |