Change registrations to be disabled by default for new servers (#29354)
This commit is contained in:
parent
c7312411b8
commit
3fecb36739
5 changed files with 15 additions and 16 deletions
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
%p.lead= t('admin.settings.registrations.preamble')
|
%p.lead= t('admin.settings.registrations.preamble')
|
||||||
|
|
||||||
|
.flash-message= t('admin.settings.registrations.moderation_recommandation')
|
||||||
|
|
||||||
.fields-row
|
.fields-row
|
||||||
.fields-row__column.fields-row__column-6.fields-group
|
.fields-row__column.fields-row__column-6.fields-group
|
||||||
= f.input :registrations_mode, collection: %w(open approved none), wrapper: :with_label, include_blank: false, label_method: lambda { |mode| I18n.t("admin.settings.registrations_mode.modes.#{mode}") }
|
= f.input :registrations_mode, collection: %w(open approved none), wrapper: :with_label, include_blank: false, label_method: lambda { |mode| I18n.t("admin.settings.registrations_mode.modes.#{mode}") }
|
||||||
|
|
|
@ -745,6 +745,7 @@ en:
|
||||||
disabled: To no one
|
disabled: To no one
|
||||||
users: To logged-in local users
|
users: To logged-in local users
|
||||||
registrations:
|
registrations:
|
||||||
|
moderation_recommandation: Please make sure you have an adequate and reactive moderation team before you open registrations to everyone!
|
||||||
preamble: Control who can create an account on your server.
|
preamble: Control who can create an account on your server.
|
||||||
title: Registrations
|
title: Registrations
|
||||||
registrations_mode:
|
registrations_mode:
|
||||||
|
|
|
@ -9,7 +9,7 @@ defaults: &defaults
|
||||||
site_terms: ''
|
site_terms: ''
|
||||||
site_contact_username: ''
|
site_contact_username: ''
|
||||||
site_contact_email: ''
|
site_contact_email: ''
|
||||||
registrations_mode: 'open'
|
registrations_mode: 'none'
|
||||||
profile_directory: true
|
profile_directory: true
|
||||||
closed_registrations_message: ''
|
closed_registrations_message: ''
|
||||||
open_deletion: true
|
open_deletion: true
|
||||||
|
|
|
@ -142,22 +142,12 @@ RSpec.describe Setting, type: :model do
|
||||||
context 'records includes nothing' do
|
context 'records includes nothing' do
|
||||||
let(:records) { [] }
|
let(:records) { [] }
|
||||||
|
|
||||||
context 'default_value is not a Hash' do
|
it 'includes Setting with value of default_value' do
|
||||||
it 'includes Setting with value of default_value' do
|
setting = described_class.all_as_records[key]
|
||||||
setting = described_class.all_as_records[key]
|
|
||||||
|
|
||||||
expect(setting).to be_kind_of Setting
|
expect(setting).to be_a described_class
|
||||||
expect(setting).to have_attributes(var: key)
|
expect(setting).to have_attributes(var: key)
|
||||||
expect(setting).to have_attributes(value: 'default_value')
|
expect(setting).to have_attributes(value: default_value)
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'default_value is a Hash' do
|
|
||||||
let(:default_value) { { 'foo' => 'fuga' } }
|
|
||||||
|
|
||||||
it 'returns {}' do
|
|
||||||
expect(described_class.all_as_records).to eq({})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,6 +30,12 @@ RSpec.configure do |config|
|
||||||
config.before :suite do
|
config.before :suite do
|
||||||
Rails.application.load_seed
|
Rails.application.load_seed
|
||||||
Chewy.strategy(:bypass)
|
Chewy.strategy(:bypass)
|
||||||
|
|
||||||
|
# NOTE: we switched registrations mode to closed by default, but the specs
|
||||||
|
# very heavily rely on having it enabled by default, as it relies on users
|
||||||
|
# being approved by default except in select cases where explicitly testing
|
||||||
|
# other registration modes
|
||||||
|
Setting.registrations_mode = 'open'
|
||||||
end
|
end
|
||||||
|
|
||||||
config.after :suite do
|
config.after :suite do
|
||||||
|
|
Loading…
Reference in a new issue