about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-11-19 12:13:57 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-11-19 04:13:57 +0100
commitbfdcf76a6481476e84fde34c3dedc86d267bcbf7 (patch)
treeff24256b41581f9cda881d92023d53d45589bcca /app
parentb380e9d2cbe52ea64fffc72d203523ab815d6333 (diff)
Add “staff” badge to admin user pages (#5735)
* Allow staff badge to change from setting to hidden

* i18n: Update Polish translation
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/settings_controller.rb2
-rw-r--r--app/models/form/admin_settings.rb2
-rw-r--r--app/views/accounts/_header.html.haml17
-rw-r--r--app/views/admin/settings/edit.html.haml3
4 files changed, 16 insertions, 8 deletions
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index e81290228..d9199b3d5 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -13,6 +13,7 @@ module Admin
       closed_registrations_message
       open_deletion
       timeline_preview
+      show_staff_badge
       bootstrap_timeline_accounts
       thumbnail
     ).freeze
@@ -21,6 +22,7 @@ module Admin
       open_registrations
       open_deletion
       timeline_preview
+      show_staff_badge
     ).freeze
 
     UPLOAD_SETTINGS = %w(
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 2b148c82b..6e9a2cd4b 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -24,6 +24,8 @@ class Form::AdminSettings
     :open_deletion=,
     :timeline_preview,
     :timeline_preview=,
+    :show_staff_badge,
+    :show_staff_badge=,
     :bootstrap_timeline_accounts,
     :bootstrap_timeline_accounts=,
     to: Setting
diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml
index 76371b656..d4081af64 100644
--- a/app/views/accounts/_header.html.haml
+++ b/app/views/accounts/_header.html.haml
@@ -27,14 +27,15 @@
         %span @#{account.local_username_and_domain}
         = fa_icon('lock') if account.locked?
 
-    - if account.user_admin?
-      .roles
-        .account-role.admin
-          = t 'accounts.roles.admin'
-    - elsif account.user_moderator?
-      .roles
-        .account-role.moderator
-          = t 'accounts.roles.moderator'
+    - if Setting.show_staff_badge
+      - if account.user_admin?
+        .roles
+          .account-role.admin
+            = t 'accounts.roles.admin'
+      - elsif account.user_moderator?
+        .roles
+          .account-role.moderator
+            = t 'accounts.roles.moderator'
 
     .bio
       .account__header__content.p-note.emojify= Formatter.instance.simplified_format(account)
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index 468166035..b07718315 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -19,6 +19,9 @@
     = f.input :timeline_preview, as: :boolean, wrapper: :with_label, label: t('admin.settings.timeline_preview.title'), hint: t('admin.settings.timeline_preview.desc_html')
 
   .fields-group
+    = f.input :show_staff_badge, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_staff_badge.title'), hint: t('admin.settings.show_staff_badge.desc_html')
+
+  .fields-group
     = f.input :open_registrations, as: :boolean, wrapper: :with_label, label: t('admin.settings.registrations.open.title'), hint: t('admin.settings.registrations.open.desc_html')
 
   .fields-group