From 992218f05f76106857f2cb5a72c0bb4510aa4563 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 4 May 2019 19:25:58 -0500 Subject: [PATCH] Anxiety reduction: add option to hide mascot. --- app/controllers/settings/preferences_controller.rb | 1 + app/lib/user_settings_decorator.rb | 7 ++++++- app/models/user.rb | 5 +++++ app/views/layouts/application.html.haml | 4 ++++ app/views/settings/preferences/show.html.haml | 1 + config/locales/simple_form.en.yml | 1 + 6 files changed, 18 insertions(+), 1 deletion(-) 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 diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index ae31ba55e..f422afdff 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -126,6 +126,7 @@ en: setting_hide_mntions_packm8: Filter group chat branches addressed to participants you aren't a packmate of setting_gently_kobolds: Gently the kobolds setting_user_is_kobold: I am a kobold + setting_hide_mascot: Don't show the mascot image setting_aggregate_reblogs: Group repeats in timelines setting_auto_play_gif: Auto-play animated GIFs setting_boost_modal: Show confirmation dialog before repeating