Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/digest...
[akkoma] / lib / pleroma / web / twitter_api / controllers / util_controller.ex
index e6057e072716d8392477d8e5db63d4238a7c9a85..ed45ca73574fc62b407ff0429f08beb3f88c107f 100644 (file)
@@ -293,12 +293,23 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
     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
     follow_import(conn, %{"list" => File.read!(listfile.path)})
   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