]> cat aescling's git repositories - mastodon.git/commitdiff
add admin setting for default search engine indexing (fix #11750) (#11804)
authorTao Bror Bojlén <brortao@users.noreply.github.com>
Wed, 11 Sep 2019 06:44:58 +0000 (07:44 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 11 Sep 2019 06:44:58 +0000 (08:44 +0200)
app/lib/settings/scoped_settings.rb
app/models/form/admin_settings.rb
app/views/admin/settings/edit.html.haml
config/locales/en.yml
spec/controllers/application_controller_spec.rb

index 3653ab1149d5432c53cb709f0b6e3ba4e5e022c9..9ca39510acd3a3ac567de71cd6b60c021946055f 100644 (file)
@@ -4,6 +4,7 @@ module Settings
   class ScopedSettings
     DEFAULTING_TO_UNSCOPED = %w(
       theme
+      noindex
     ).freeze
 
     def initialize(object)
index 6bc3ca9f528c4440498b525ba5987920b25c9e5b..24196e1828d42ccfc389ae6f51e382c86d21dd85 100644 (file)
@@ -32,6 +32,7 @@ class Form::AdminSettings
     trends
     show_domain_blocks
     show_domain_blocks_rationale
+    noindex
   ).freeze
 
   BOOLEAN_KEYS = %i(
@@ -45,6 +46,7 @@ class Form::AdminSettings
     profile_directory
     spam_check_enabled
     trends
+    noindex
   ).freeze
 
   UPLOAD_KEYS = %i(
index 28880c087eb8463cf06b164ff24b350b7205f266..752386b3ca326fd396abdb920b79fd6253e649d0 100644 (file)
@@ -71,6 +71,9 @@
     .fields-group
       = 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
     = 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')
 
index 52cb4a2692e5dc6621c00283b48c58073fd3ef65..0a5ca31c1aa7adf72cb779dab550205bf050f6ec 100644 (file)
@@ -427,6 +427,9 @@ en:
       custom_css:
         desc_html: Modify the look with CSS loaded on every page
         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:
         all: To everyone
         disabled: To no one
index 1811500dfe57a2eced51714d85c06b79473e35e8..da4a794cddc30d94adcdbc8c200e2cf01173987b 100644 (file)
@@ -110,6 +110,7 @@ describe ApplicationController, type: :controller do
       sign_in current_user
 
       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'
     end