Runtime configured emojis
[akkoma] / lib / pleroma / web / twitter_api / controllers / util_controller.ex
index 4aaf28869c7dc8333651e209c7fc3296d7dcc33c..e84438e97d561b47c9cd3216d8bf05c6c80571e8 100644 (file)
@@ -6,7 +6,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
   alias Pleroma.Web.WebFinger
   alias Pleroma.Web.CommonAPI
   alias Comeonin.Pbkdf2
-  alias Pleroma.Formatter
+  alias Pleroma.{Formatter, Emoji}
   alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.{Repo, PasswordResetToken, User}
 
@@ -177,7 +177,9 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
           showInstanceSpecificPanel: Keyword.get(@instance_fe, :show_instance_panel),
           scopeOptionsEnabled: Keyword.get(@instance_fe, :scope_options_enabled),
           formattingOptionsEnabled: Keyword.get(@instance_fe, :formatting_options_enabled),
-          collapseMessageWithSubject: Keyword.get(@instance_fe, :collapse_message_with_subject)
+          collapseMessageWithSubject: Keyword.get(@instance_fe, :collapse_message_with_subject),
+          hidePostStats: Keyword.get(@instance_fe, :hide_post_stats),
+          hideUserStats: Keyword.get(@instance_fe, :hide_user_stats)
         }
 
         managed_config = Keyword.get(@instance, :managed_config)
@@ -210,7 +212,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
   end
 
   def emoji(conn, _params) do
-    json(conn, Enum.into(Formatter.get_custom_emoji(), %{}))
+    json(conn, Enum.into(Emoji.get_all(), %{}))
   end
 
   def follow_import(conn, %{"list" => %Plug.Upload{} = listfile}) do
@@ -223,7 +225,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
       |> Enum.map(fn account ->
         with %User{} = follower <- User.get_cached_by_ap_id(user.ap_id),
              %User{} = followed <- User.get_or_fetch(account),
-             {:ok, follower} <- User.follow(follower, followed) do
+             {:ok, follower} <- User.maybe_direct_follow(follower, followed) do
           ActivityPub.follow(follower, followed)
         else
           err -> Logger.debug("follow_import: following #{account} failed with #{inspect(err)}")