about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-05-04 19:25:58 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:22 -0500
commit992218f05f76106857f2cb5a72c0bb4510aa4563 (patch)
tree11b1f7636e09abd48f72d6a4a611dc1ae8b90d9b /app
parent545330dc657e78ee17bb58b094328054380eeb4f (diff)
Anxiety reduction: add option to hide mascot.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/preferences_controller.rb1
-rw-r--r--app/lib/user_settings_decorator.rb7
-rw-r--r--app/models/user.rb5
-rwxr-xr-xapp/views/layouts/application.html.haml4
-rw-r--r--app/views/settings/preferences/show.html.haml1
5 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index f71cbb1fe..afd6ee388 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -47,6 +47,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_hide_mntions_packm8,
       :setting_gently_kobolds,
       :setting_user_is_kobold,
+      :setting_hide_mascot,
 
       :setting_default_privacy,
       :setting_default_sensitive,
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index 39e8a82fe..3dff63af4 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -32,8 +32,9 @@ class UserSettingsDecorator
     user.settings['hide_mntions_packm8'] = hide_mntions_packm8_preference if change?('setting_hide_mntions_packm8')
     user.settings['gently_kobolds']      = gently_kobolds_preference if change?('setting_gently_kobolds')
     user.settings['user_is_kobold']      = user_is_kobold_preference if change?('setting_user_is_kobold')
-
     user.settings['hide_captions']       = hide_captions_preference if change?('setting_hide_captions')
+    user.settings['hide_mascot']         = hide_mascot_preference if change?('setting_hide_mascot')
+
     user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
     user.settings['interactions']        = merged_interactions if change?('interactions')
     user.settings['default_privacy']     = default_privacy_preference if change?('setting_default_privacy')
@@ -110,6 +111,10 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_user_is_kobold'
   end
 
+  def hide_mascot_preference
+    boolean_cast_setting 'setting_hide_mascot'
+  end
+
   def merged_notification_emails
     user.settings['notification_emails'].merge coerced_settings('notification_emails').to_h
   end
diff --git a/app/models/user.rb b/app/models/user.rb
index b4328afcb..95d2e6ffb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -121,6 +121,7 @@ class User < ApplicationRecord
     :hide_mntions_packm8,
     :gently_kobolds,
     :user_is_kobold,
+    :hide_mascot,
 
     :auto_play_gif,
     :default_sensitive,
@@ -275,6 +276,10 @@ class User < ApplicationRecord
     settings.user_is_kobold || false
   end
 
+  def setting_hide_mascot
+    settings.hide_mascot || false
+  end
+
   def setting_default_privacy
     settings.default_privacy || 'public'
   end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 00d8af13a..6bd9a00ab 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -81,5 +81,9 @@
       :css
         .status__wrapper--filtered { display: none !important; }
 
+    - if current_account&.user&.setting_hide_mascot
+      :css
+        .drawer__inner__mastodon>img { display: none !important }
+
   %body{ class: body_classes }
     = content_for?(:content) ? yield(:content) : yield
diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml
index 634cd53ff..0bc83130c 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -63,6 +63,7 @@
     = f.input :setting_larger_drawer, as: :boolean, wrapper: :with_label
 
   .fields-group
+    = f.input :setting_hide_mascot, as: :boolean, wrapper: :with_label
     = f.input :setting_remove_filtered, as: :boolean, wrapper: :with_label
     = f.input :setting_hide_replies_muted, as: :boolean, wrapper: :with_label
     = f.input :setting_hide_replies_blocked, as: :boolean, wrapper: :with_label