1
0

add admin setting for default search engine indexing (fix #11750) (#11804)

This commit is contained in:
Tao Bror Bojlén 2019-09-11 07:44:58 +01:00 committed by Eugen Rochko
parent 4faaa5b25e
commit 4fe127664b
5 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ module Settings
class ScopedSettings class ScopedSettings
DEFAULTING_TO_UNSCOPED = %w( DEFAULTING_TO_UNSCOPED = %w(
theme theme
noindex
).freeze ).freeze
def initialize(object) def initialize(object)

View File

@ -32,6 +32,7 @@ class Form::AdminSettings
trends trends
show_domain_blocks show_domain_blocks
show_domain_blocks_rationale show_domain_blocks_rationale
noindex
).freeze ).freeze
BOOLEAN_KEYS = %i( BOOLEAN_KEYS = %i(
@ -45,6 +46,7 @@ class Form::AdminSettings
profile_directory profile_directory
spam_check_enabled spam_check_enabled
trends trends
noindex
).freeze ).freeze
UPLOAD_KEYS = %i( UPLOAD_KEYS = %i(

View File

@ -71,6 +71,9 @@
.fields-group .fields-group
= f.input :trends, as: :boolean, wrapper: :with_label, label: t('admin.settings.trends.title'), hint: t('admin.settings.trends.desc_html') = f.input :trends, as: :boolean, wrapper: :with_label, label: t('admin.settings.trends.title'), hint: t('admin.settings.trends.desc_html')
.fields-group
= f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html')
.fields-group .fields-group
= f.input :spam_check_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.spam_check_enabled.title'), hint: t('admin.settings.spam_check_enabled.desc_html') = f.input :spam_check_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.spam_check_enabled.title'), hint: t('admin.settings.spam_check_enabled.desc_html')

View File

@ -427,6 +427,9 @@ en:
custom_css: custom_css:
desc_html: Modify the look with CSS loaded on every page desc_html: Modify the look with CSS loaded on every page
title: Custom CSS title: Custom CSS
default_noindex:
desc_html: Affects all users who have not changed this setting themselves
title: Opt users out of search engine indexing by default
domain_blocks: domain_blocks:
all: To everyone all: To everyone
disabled: To no one disabled: To no one

View File

@ -110,6 +110,7 @@ describe ApplicationController, type: :controller do
sign_in current_user sign_in current_user
allow(Setting).to receive(:[]).with('theme').and_return 'contrast' allow(Setting).to receive(:[]).with('theme').and_return 'contrast'
allow(Setting).to receive(:[]).with('noindex').and_return false
expect(controller.view_context.current_theme).to eq 'contrast' expect(controller.view_context.current_theme).to eq 'contrast'
end end