diff options
author | lain <lain@soykaf.club> | 2020-09-02 18:32:00 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-09-02 18:32:00 +0200 |
commit | 581f382e712dc50fa51d1ab211f13b8843dcb448 (patch) | |
tree | f1d4b96768e047d85d3ecb50de507c1a874bb208 | |
parent | d8728580468ecf876e531440fa31aef6a3e33f7b (diff) | |
download | pleroma-581f382e712dc50fa51d1ab211f13b8843dcb448.tar.gz |
ListController: DRY up stuff.
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/list_controller.ex | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex index 4df13cb81..5daeaa780 100644 --- a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex @@ -74,7 +74,7 @@ defmodule Pleroma.Web.MastodonAPI.ListController do # DELETE /api/v1/lists/:id/accounts def remove_from_list( - %{assigns: %{list: list}, body_params: %{account_ids: account_ids}} = conn, + %{assigns: %{list: list}, params: %{account_ids: account_ids}} = conn, _ ) do Enum.each(account_ids, fn account_id -> @@ -86,17 +86,8 @@ defmodule Pleroma.Web.MastodonAPI.ListController do json(conn, %{}) end - def remove_from_list( - %{assigns: %{list: list}, params: %{account_ids: account_ids}} = conn, - _ - ) do - Enum.each(account_ids, fn account_id -> - with %User{} = followed <- User.get_cached_by_id(account_id) do - Pleroma.List.unfollow(list, followed) - end - end) - - json(conn, %{}) + def remove_from_list(%{body_params: params} = conn, _) do + remove_from_list(%{conn | params: params}, %{}) end defp list_by_id_and_user(%{assigns: %{user: user}, params: %{id: id}} = conn, _) do |