Merge branch 'develop' into feature/788-separate-email-addresses
[akkoma] / lib / pleroma / web / twitter_api / controllers / util_controller.ex
index 3cdd7a2f254693af44db3da09864b43cf292a831..d066d35f5c129b0463b9a094506c0f24b9553a63 100644 (file)
@@ -283,7 +283,20 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
   end
 
   def emoji(conn, _params) do
-    json(conn, Enum.into(Emoji.get_all(), %{}))
+    emoji =
+      Emoji.get_all()
+      |> Enum.map(fn {short_code, path, tags} ->
+        {short_code, %{image_url: path, tags: String.split(tags, ",")}}
+      end)
+      |> Enum.into(%{})
+
+    json(conn, emoji)
+  end
+
+  def update_notificaton_settings(%{assigns: %{user: user}} = conn, params) do
+    with {:ok, _} <- User.update_notification_settings(user, params) do
+      json(conn, %{status: "success"})
+    end
   end
 
   def follow_import(conn, %{"list" => %Plug.Upload{} = listfile}) do