diff options
| author | Roger Braun <roger@rogerbraun.net> | 2017-11-16 09:40:06 +0100 | 
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2017-11-16 09:40:06 +0100 | 
| commit | 8de890a0d9388979d7b86744dfbed7ac08635fee (patch) | |
| tree | 85ba1c738dee6b7b04dfe2dfe3c2741c5db4027f /lib | |
| parent | 3d1360c4d6855d5eceaa00a4544e97e0a60613c0 (diff) | |
| download | pleroma-8de890a0d9388979d7b86744dfbed7ac08635fee.tar.gz pleroma-8de890a0d9388979d7b86744dfbed7ac08635fee.zip | |
Add custom emoji to Mastodon UI initial state.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index c15c47fa1..8b5714555 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -113,8 +113,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do      json(conn, response)    end -  def custom_emojis(conn, _params) do -    mastodon_emoji = Pleroma.Formatter.get_custom_emoji() +  defp mastodonized_emoji do +    Pleroma.Formatter.get_custom_emoji()      |> Enum.map(fn {shortcode, relative_url} ->        url = to_string URI.merge(Web.base_url(), relative_url)        %{ @@ -123,6 +123,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do          "url" => url        }      end) +  end + +  def custom_emojis(conn, _params) do +    mastodon_emoji = mastodonized_emoji()      json conn, mastodon_emoji    end @@ -473,6 +477,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do      |> get_session(:oauth_token)      if user && token do +      mastodon_emoji = mastodonized_emoji()        accounts = Map.put(%{}, user.id, AccountView.render("account.json", %{user: user}))        initial_state = %{          meta: %{ @@ -540,7 +545,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do          },          push_subscription: nil,          accounts: accounts, -        custom_emojis: %{} +        custom_emojis: mastodon_emoji        } |> Poison.encode!        conn        |> put_layout(false) | 
