diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-24 15:56:20 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-26 10:33:13 +0700 |
commit | c57ad0a4020fe88521b83d471fb8b71d637fddf1 (patch) | |
tree | bbfa234dec8ab0f7cf1ac25e5bd50dd6f0b50f44 /lib/pleroma/web/common_api/utils.ex | |
parent | de3e90e536ea0759b024155aee307cc340db3cf1 (diff) | |
download | pleroma-c57ad0a4020fe88521b83d471fb8b71d637fddf1.tar.gz |
Cleanup CommonAPI
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 8093a56a6..88a5f434a 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -231,7 +231,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do no_attachment_links = data |> Map.get("no_attachment_links", Config.get([:instance, :no_attachment_links])) - |> Kernel.in([true, "true"]) + |> truthy_param?() content_type = get_content_type(data["content_type"]) @@ -431,12 +431,14 @@ defmodule Pleroma.Web.CommonAPI.Utils do end end - def emoji_from_profile(%{info: _info} = user) do - (Emoji.Formatter.get_emoji(user.bio) ++ Emoji.Formatter.get_emoji(user.name)) - |> Enum.map(fn {shortcode, %Emoji{file: url}} -> + def emoji_from_profile(%User{bio: bio, name: name}) do + [bio, name] + |> Enum.map(&Emoji.Formatter.get_emoji/1) + |> Enum.concat() + |> Enum.map(fn {shortcode, %Emoji{file: path}} -> %{ "type" => "Emoji", - "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}#{url}"}, + "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}#{path}"}, "name" => ":#{shortcode}:" } end) |