diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index d1b8a902311..68fab9cbf8d 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -49,6 +49,7 @@ class Form::AdminSettings email_footer_text opt_in_server_directory opt_in_server_recommendation + postpone_confirmation_emails ).freeze INTEGER_KEYS = %i( @@ -73,6 +74,7 @@ class Form::AdminSettings opt_in_server_directory opt_in_server_recommendation wrapstodon + postpone_confirmation_emails ).freeze UPLOAD_KEYS = %i( diff --git a/app/models/user.rb b/app/models/user.rb index f6ff154dd67..8cd81fc5718 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -112,7 +112,7 @@ class User < ApplicationRecord scope :matches_ip, ->(value) { left_joins(:ips).merge(UserIp.contained_by(value)).group(users: [:id]) } before_validation :sanitize_role - before_create :set_approved + before_create :set_approved, prepend: true # Must be called before Devise callbacks before_create :set_age_verified_at after_commit :send_pending_devise_notifications after_create_commit :trigger_webhooks @@ -455,6 +455,8 @@ class User < ApplicationRecord open_registrations? || valid_bypassing_invitation? || external? end end + + self.disabled ||= !approved && Setting.postpone_confirmation_emails end def set_age_verified_at diff --git a/app/views/admin/settings/registrations/show.html.haml b/app/views/admin/settings/registrations/show.html.haml index b0f22157102..3088344776c 100644 --- a/app/views/admin/settings/registrations/show.html.haml +++ b/app/views/admin/settings/registrations/show.html.haml @@ -29,6 +29,10 @@ as: :boolean, disabled: !approved_registrations?, wrapper: :with_label + .fields-group + = f.input :postpone_confirmation_emails, + as: :boolean, + wrapper: :with_label - if captcha_available? .fields-group diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 9eed1f2ef70..c69c1b02cab 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -98,6 +98,7 @@ en: media_cache_retention_period: Media files from posts made by remote users are cached on your server. When set to a positive value, media will be deleted after the specified number of days. If the media data is requested after it is deleted, it will be re-downloaded, if the source content is still available. Due to restrictions on how often link preview cards poll third-party sites, it is recommended to set this value to at least 14 days, or link preview cards will not be updated on demand before that time. min_age: Users will be asked to confirm their date of birth during sign-up peers_api_enabled: A list of domain names this server has encountered in the fediverse. No data is included here about whether you federate with a given server, just that your server knows about it. This is used by services that collect statistics on federation in a general sense. + postpone_confirmation_emails: When this setting is enabled, confirmation emails for accounts pending approval are only sent once those accounts are approved. This may provide a poorer sign-up experience if you are not able to review applications in a timely fashion. profile_directory: The profile directory lists all users who have opted-in to be discoverable. require_invite_text: When sign-ups require manual approval, make the “Why do you want to join?” text input mandatory rather than optional site_contact_email: How people can reach you for legal or support inquiries. @@ -305,6 +306,7 @@ en: media_cache_retention_period: Media cache retention period min_age: Minimum age requirement peers_api_enabled: Publish list of discovered servers in the API + postpone_confirmation_emails: Postpone confirmation emails after approval profile_directory: Enable profile directory registrations_mode: Who can sign-up remote_live_feed_access: Access to live feeds featuring remote posts diff --git a/config/settings.yml b/config/settings.yml index 3ee7ed5f697..c9bf0ca969a 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -17,6 +17,7 @@ defaults: &defaults local_topic_feed_access: 'public' remote_topic_feed_access: 'public' show_staff_badge: true + postpone_confirmation_emails: false preview_sensitive_media: false noindex: false theme: 'default'