From 51ab8d0128970dd7458e93578acb36c20b1c185c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 12 Jul 2020 20:14:57 -0500 Subject: [PATCH] Add `account_approval_required` instance setting --- config/config.exs | 1 + config/description.exs | 5 +++++ docs/configuration/cheatsheet.md | 1 + lib/pleroma/web/mastodon_api/views/instance_view.ex | 1 + .../mastodon_api/controllers/instance_controller_test.exs | 1 + 5 files changed, 9 insertions(+) diff --git a/config/config.exs b/config/config.exs index 6fc84efc2..791740663 100644 --- a/config/config.exs +++ b/config/config.exs @@ -205,6 +205,7 @@ config :pleroma, :instance, registrations_open: true, invites_enabled: false, account_activation_required: false, + account_approval_required: false, federating: true, federation_incoming_replies_max_depth: 100, federation_reachability_timeout_days: 7, diff --git a/config/description.exs b/config/description.exs index b0cc8d527..e57379dee 100644 --- a/config/description.exs +++ b/config/description.exs @@ -665,6 +665,11 @@ config :pleroma, :config_description, [ type: :boolean, description: "Require users to confirm their emails before signing in" }, + %{ + key: :account_approval_required, + type: :boolean, + description: "Require users to be manually approved by an admin before signing in" + }, %{ key: :federating, type: :boolean, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index f796330f1..94389152e 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -33,6 +33,7 @@ To add configuration to your config file, you can copy it from the base config. * `registrations_open`: Enable registrations for anyone, invitations can be enabled when false. * `invites_enabled`: Enable user invitations for admins (depends on `registrations_open: false`). * `account_activation_required`: Require users to confirm their emails before signing in. +* `account_approval_required`: Require users to be manually approved by an admin before signing in. * `federating`: Enable federation with other instances. * `federation_incoming_replies_max_depth`: Max. depth of reply-to activities fetching on incoming federation, to prevent out-of-memory situations while fetching very long threads. If set to `nil`, threads of any depth will be fetched. Lower this value if you experience out-of-memory crashes. * `federation_reachability_timeout_days`: Timeout (in days) of each external federation target being unreachable prior to pausing federating to it. diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index 5deb0d7ed..243067a73 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -39,6 +39,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do pleroma: %{ metadata: %{ account_activation_required: Keyword.get(instance, :account_activation_required), + account_approval_required: Keyword.get(instance, :account_approval_required), features: features(), federation: federation(), fields_limits: fields_limits() diff --git a/test/web/mastodon_api/controllers/instance_controller_test.exs b/test/web/mastodon_api/controllers/instance_controller_test.exs index cc880d82c..8a4183283 100644 --- a/test/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/web/mastodon_api/controllers/instance_controller_test.exs @@ -38,6 +38,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do } = result assert result["pleroma"]["metadata"]["account_activation_required"] != nil + assert result["pleroma"]["metadata"]["account_approval_required"] != nil assert result["pleroma"]["metadata"]["features"] assert result["pleroma"]["metadata"]["federation"] assert result["pleroma"]["metadata"]["fields_limits"] -- 2.45.2