about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-12-11 19:18:29 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-12-11 19:18:29 +0100
commit720daa81435b4c632cdf7b64044cf1ee59af977a (patch)
tree17b3bb837d40d102b920120e7c185655cec67aa7 /app/views
parenta48fe52375f207f538b3be675a943c3dd8603541 (diff)
Add instance-wide setting to disable profile directory (#9497)
* Add instance-wide setting to disable profile directory

Fixes #9496

When the profile directory is disabled:
- The “discoverable” setting is hidden from users
- The “profile directory” link is not shown on public pages
- /explore returns 404

* Move Setting.profile_directory check to a before_action filter
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin/dashboard/index.html.haml6
-rw-r--r--app/views/admin/settings/edit.html.haml3
-rw-r--r--app/views/layouts/public.html.haml3
-rw-r--r--app/views/settings/profiles/show.html.haml5
4 files changed, 14 insertions, 3 deletions
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index 1996eef4d..fa3d70e9e 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -58,6 +58,12 @@
           - else
             %span.pull-right.negative-hint= fa_icon 'times fw'
         %li
+          = link_to t('admin.dashboard.feature_profile_directory'), edit_admin_settings_path
+          - if @profile_directory
+            %span.pull-right.positive-hint= fa_icon 'check fw'
+          - else
+            %span.pull-right.negative-hint= fa_icon 'times fw'
+        %li
           = link_to t('admin.dashboard.feature_relay'), admin_relays_path
           - if @relay_enabled
             %span.pull-right.positive-hint= fa_icon 'check fw'
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index 04b1a6754..7afa9ec37 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -62,6 +62,9 @@
   .fields-group
     = f.input :preview_sensitive_media, as: :boolean, wrapper: :with_label, label: t('admin.settings.preview_sensitive_media.title'), hint: t('admin.settings.preview_sensitive_media.desc_html')
 
+  .fields-group
+    = f.input :profile_directory, as: :boolean, wrapper: :with_label, label: t('admin.settings.profile_directory.title'), hint: t('admin.settings.profile_directory.desc_html')
+
   %hr.spacer/
 
   .fields-group
diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml
index 831c7f012..93ed12f18 100644
--- a/app/views/layouts/public.html.haml
+++ b/app/views/layouts/public.html.haml
@@ -9,7 +9,8 @@
           = link_to root_url, class: 'brand' do
             = image_tag asset_pack_path('logo_full.svg'), alt: 'Mastodon'
 
-          = link_to t('directories.directory'), explore_path, class: 'nav-link'
+          - if Setting.profile_directory
+            = link_to t('directories.directory'), explore_path, class: 'nav-link'
           = link_to t('about.about_this'), about_more_path, class: 'nav-link'
           = link_to t('about.apps'), 'https://joinmastodon.org/apps', class: 'nav-link'
         .nav-center
diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index fa3869f6f..eb232dc57 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -26,8 +26,9 @@
   .fields-group
     = f.input :bot, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.bot')
 
-  .fields-group
-    = f.input :discoverable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.discoverable_html', min_followers: Account::MIN_FOLLOWERS_DISCOVERY, path: explore_path)
+  - if Setting.profile_directory
+    .fields-group
+      = f.input :discoverable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.discoverable_html', min_followers: Account::MIN_FOLLOWERS_DISCOVERY, path: explore_path)
 
   %hr.spacer/