diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-11-12 18:36:50 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-11-12 18:45:28 +0700 |
commit | e6d7e27bd603806e96dfc2774f90cadb3cf73a8c (patch) | |
tree | 96b9c5de9bc8c43ee3bcd1e449bb19cec950a6e6 /lib/pleroma/web | |
parent | 61fc739ab8917ccb5a12d6ab6db6130dc231990b (diff) | |
download | pleroma-e6d7e27bd603806e96dfc2774f90cadb3cf73a8c.tar.gz |
Add `allow_following_move` setting to User
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/account_controller.ex | 1 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/account_view.ex | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index 73fad519e..7df7dc097 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -152,6 +152,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do :hide_favorites, :show_role, :skip_thread_containment, + :allow_following_move, :discoverable ] |> Enum.reduce(%{}, fn key, acc -> diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index e30fed610..7aae7d188 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -163,6 +163,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do |> maybe_put_chat_token(user, opts[:for], opts) |> maybe_put_activation_status(user, opts[:for]) |> maybe_put_follow_requests_count(user, opts[:for]) + |> maybe_put_allow_following_move(user, opts[:for]) |> maybe_put_unread_conversation_count(user, opts[:for]) end @@ -239,6 +240,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do defp maybe_put_notification_settings(data, _, _), do: data + defp maybe_put_allow_following_move(data, %User{id: user_id} = user, %User{id: user_id}) do + Kernel.put_in(data, [:pleroma, :allow_following_move], user.allow_following_move) + end + + defp maybe_put_allow_following_move(data, _, _), do: data + defp maybe_put_activation_status(data, user, %User{is_admin: true}) do Kernel.put_in(data, [:pleroma, :deactivated], user.deactivated) end |