Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/digest...
[akkoma] / lib / pleroma / web / twitter_api / controllers / util_controller.ex
index bb71742ec48c79f20398fc7d8b647318cb5b53de..ed45ca73574fc62b407ff0429f08beb3f88c107f 100644 (file)
@@ -286,8 +286,9 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
     emoji =
       Emoji.get_all()
       |> Enum.map(fn {short_code, path, tags} ->
-        %{short_code => %{image_url: path, tags: String.split(tags, ",")}}
+        {short_code, %{image_url: path, tags: String.split(tags, ",")}}
       end)
+      |> Enum.into(%{})
 
     json(conn, emoji)
   end
@@ -303,7 +304,12 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
   end
 
   def follow_import(%{assigns: %{user: follower}} = conn, %{"list" => list}) do
-    with followed_identifiers <- String.split(list),
+    with lines <- String.split(list, "\n"),
+         followed_identifiers <-
+           Enum.map(lines, fn line ->
+             String.split(line, ",") |> List.first()
+           end)
+           |> List.delete("Account address"),
          {:ok, _} = Task.start(fn -> User.follow_import(follower, followed_identifiers) end) do
       json(conn, "job started")
     end