diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 10 | ||||
-rw-r--r-- | lib/pleroma/user/email_list.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/api_spec/operations/account_operation.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/account_controller.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/account_view.ex | 10 | ||||
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 35910aaff..ef5639500 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -148,7 +148,7 @@ defmodule Pleroma.User do field(:accepts_chat_messages, :boolean, default: nil) field(:last_active_at, :naive_datetime) field(:disclose_client, :boolean, default: true) - field(:accepts_newsletter, :boolean, default: false) + field(:accepts_email_list, :boolean, default: false) embeds_one( :notification_settings, @@ -517,7 +517,7 @@ defmodule Pleroma.User do :actor_type, :accepts_chat_messages, :disclose_client, - :accepts_newsletter + :accepts_email_list ] ) |> unique_constraint(:nickname) @@ -681,7 +681,7 @@ defmodule Pleroma.User do :nickname, :email, :accepts_chat_messages, - :accepts_newsletter + :accepts_email_list ]) |> validate_required([:name, :nickname]) |> unique_constraint(:nickname) @@ -726,7 +726,7 @@ defmodule Pleroma.User do :emoji, :accepts_chat_messages, :registration_reason, - :accepts_newsletter + :accepts_email_list ]) |> validate_required([:name, :nickname, :password, :password_confirmation]) |> validate_confirmation(:password) @@ -1714,7 +1714,7 @@ defmodule Pleroma.User do raw_fields: [], is_discoverable: false, also_known_as: [], - accepts_newsletter: false + accepts_email_list: false }) end diff --git a/lib/pleroma/user/email_list.ex b/lib/pleroma/user/email_list.ex index f6e5ea619..70850941a 100644 --- a/lib/pleroma/user/email_list.ex +++ b/lib/pleroma/user/email_list.ex @@ -19,7 +19,7 @@ defmodule Pleroma.User.EmailList do is_active: true, is_approved: true, is_confirmed: true, - accepts_newsletter: true + accepts_email_list: true }) |> where([u], not is_nil(u.email)) end diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 0dec46139..ae34ca726 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -459,7 +459,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do nullable: true, description: "Invite token required when the registrations aren't public" }, - accepts_newsletter: %Schema{ + accepts_email_list: %Schema{ allOf: [BooleanLike], description: "Whether the user opts-in to receiving news and marketing updates from site admins. These should be presented to the user in order to allow them to consent before setting this parameter to TRUE." @@ -641,7 +641,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do "Discovery (listing, indexing) of this account by external services (search bots etc.) is allowed." }, actor_type: ActorType, - accepts_newsletter: %Schema{ + accepts_email_list: %Schema{ allOf: [BooleanLike], description: "Whether the user opts-in to receiving news and marketing updates from site admins." diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index c7e21a0d2..e6f41757e 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -186,7 +186,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do :allow_following_move, :also_known_as, :accepts_chat_messages, - :accepts_newsletter + :accepts_email_list ] |> Enum.reduce(%{}, fn key, acc -> Maps.put_if_present(acc, key, params[key], &{:ok, truthy_param?(&1)}) diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index c3a0be006..fc1536440 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -292,7 +292,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do |> maybe_put_allow_following_move(user, opts[:for]) |> maybe_put_unread_conversation_count(user, opts[:for]) |> maybe_put_unread_notification_count(user, opts[:for]) - |> maybe_put_accepts_newsletter(user, opts[:for]) + |> maybe_put_accepts_email_list(user, opts[:for]) end defp username_from_nickname(string) when is_binary(string) do @@ -404,15 +404,15 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do defp maybe_put_unread_notification_count(data, _, _), do: data - defp maybe_put_accepts_newsletter(data, %User{id: user_id}, %User{id: user_id} = user) do + defp maybe_put_accepts_email_list(data, %User{id: user_id}, %User{id: user_id} = user) do Kernel.put_in( data, - [:pleroma, :accepts_newsletter], - user.accepts_newsletter + [:pleroma, :accepts_email_list], + user.accepts_email_list ) end - defp maybe_put_accepts_newsletter(data, _, _), do: data + defp maybe_put_accepts_email_list(data, _, _), do: data defp image_url(%{"url" => [%{"href" => href} | _]}), do: href defp image_url(_), do: nil diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index f6250a313..132ecb610 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -14,7 +14,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do def register_user(params, opts \\ []) do params = params - |> Map.take([:email, :token, :password, :accepts_newsletter]) + |> Map.take([:email, :token, :password, :accepts_email_list]) |> Map.put(:bio, params |> Map.get(:bio, "") |> User.parse_bio()) |> Map.put(:nickname, params[:username]) |> Map.put(:name, Map.get(params, :fullname, params[:username])) |