about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/settings/preferences_controller.rb3
-rw-r--r--app/lib/user_settings_decorator.rb11
-rw-r--r--app/models/user.rb35
-rwxr-xr-xapp/views/layouts/application.html.haml15
-rw-r--r--app/views/settings/preferences/show.html.haml7
-rw-r--r--config/locales/simple_form.en.yml9
6 files changed, 67 insertions, 13 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index def3ade1c..0aa083a4a 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -29,11 +29,12 @@ class Settings::PreferencesController < Settings::BaseController
 
   def user_settings_params
     params.require(:user).permit(
-      :setting_default_privacy,
       :setting_default_local,
       :setting_always_local,
       :setting_rawr_federated,
       :setting_hide_stats,
+      :setting_hide_captions,
+      :setting_default_privacy,
       :setting_default_sensitive,
       :setting_default_language,
       :setting_unfollow_modal,
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index a851ff217..182fb640b 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -15,13 +15,14 @@ class UserSettingsDecorator
   private
 
   def process_update
-    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')
     user.settings['default_local']       = default_local_preference if change?('setting_default_local')
     user.settings['always_local']        = always_local_preference if change?('setting_always_local')
     user.settings['rawr_federated']      = rawr_federated_preference if change?('setting_rawr_federated')
     user.settings['hide_stats']          = hide_stats_preference if change?('setting_hide_stats')
+    user.settings['hide_captions']       = hide_captions_preference if change?('setting_hide_captions')
+    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')
     user.settings['default_sensitive']   = default_sensitive_preference if change?('setting_default_sensitive')
     user.settings['default_language']    = default_language_preference if change?('setting_default_language')
     user.settings['unfollow_modal']      = unfollow_modal_preference if change?('setting_unfollow_modal')
@@ -71,6 +72,10 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_hide_stats'
   end
 
+  def hide_captions_preference
+    boolean_cast_setting 'setting_hide_captions'
+  end
+
   def default_sensitive_preference
     boolean_cast_setting 'setting_default_sensitive'
   end
diff --git a/app/models/user.rb b/app/models/user.rb
index e2be2ce9e..9e611d33f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -102,9 +102,34 @@ class User < ApplicationRecord
 
   has_many :session_activations, dependent: :destroy
 
-  delegate :auto_play_gif, :default_local, :always_local, :rawr_federated, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
-           :hide_stats, :reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_network, :hide_followers_count,
-           :expand_spoilers, :default_language, :aggregate_reblogs, :show_application, :default_content_type, to: :settings, prefix: :setting, allow_nil: false
+  delegate :default_local,
+    :always_local,
+    :rawr_federated,
+    :hide_stats,
+    :disable_color,
+    :hide_captions,
+    :auto_play_gif,
+    :default_sensitive,
+    :unfollow_modal,
+    :boost_modal,
+    :favourite_modal,
+    :delete_modal,
+    :reduce_motion,
+    :system_font_ui,
+    :noindex,
+    :flavour,
+    :skin,
+    :display_media,
+    :hide_network,
+    :hide_followers_count,
+    :expand_spoilers,
+    :default_language,
+    :aggregate_reblogs,
+    :show_application,
+    :default_content_type,
+    to: :settings,
+    prefix: :setting,
+    allow_nil: false
 
   attr_reader :invite_code
   attr_writer :external
@@ -204,6 +229,10 @@ class User < ApplicationRecord
     settings.hide_stats || false
   end
 
+  def setting_hide_captions
+    settings.hide_captions || false
+  end
+
   def allows_digest_emails?
     settings.notification_emails['digest']
   end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 34c25a7d1..158abc120 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -37,5 +37,20 @@
     - if Setting.custom_css.present?
       = stylesheet_link_tag custom_css_path, media: 'all'
 
+		- if current_account&.user&.setting_disable_color
+      :css
+        .status__content p > span,
+        .reply-indicator__content p > span,
+        .composer--reply > .content p > span,
+        .account__header__content p > span,
+        .account__header__fields p > span
+        { color: inherit !important }
+
+    - if current_account&.user&.setting_hide_captions
+      :css
+        div .media-caption,
+        span .caption
+        { display: none }
+
   %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 fb9fd204c..d6031d5b8 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -37,14 +37,10 @@
     = f.input :setting_rawr_federated, as: :boolean, wrapper: :with_label
 
   .fields-group
-    = f.input :setting_noindex, as: :boolean, wrapper: :with_label
-
-  .fields-group
     = f.input :setting_hide_network, as: :boolean, wrapper: :with_label
     = f.input :setting_hide_stats, as: :boolean, wrapper: :with_label
-
-  .fields-group
     = f.input :setting_show_application, as: :boolean, wrapper: :with_label
+    = f.input :setting_noindex, as: :boolean, wrapper: :with_label
 
   - unless Setting.hide_followers_count
     .fields-group
@@ -57,6 +53,7 @@
     = f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label
     = f.input :setting_disable_color, as: :boolean, wrapper: :with_label
     = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label
+    = f.input :setting_hide_captions, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index 4062aaff1..903cfd870 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -69,6 +69,7 @@ en:
           suspend: Suspend and irreversibly delete account data
         warning_preset_id: Use a warning preset
       defaults:
+        hidden: Hide public profile
         autofollow: Invite to join your pack
         avatar: Avatar
         bot: This is a bot account
@@ -88,7 +89,6 @@ en:
         irreversible: Drop instead of hide
         locale: Interface language
         locked: Lock account
-        hidden: Hide public profile
         max_uses: Max number of uses
         new_password: New password
         note: Bio
@@ -108,6 +108,13 @@ en:
         setting_always_local: Don't send your roars outside Monsterpit
         setting_rawr_federated: Show raw world timeline (may contain offensive content!)
         setting_hide_stats: Hide statistics on public pages
+        setting_disable_color: Ignore text color formatting
+        setting_hide_captions: Hide media captions
+        setting_aggregate_reblogs: Group repeats in timelines
+        setting_auto_play_gif: Auto-play animated GIFs
+        setting_boost_modal: Show confirmation dialog before repeating
+        setting_default_language: Posting language
+        setting_default_privacy: Post privacy
         setting_default_sensitive: Always mark media as sensitive
         setting_delete_modal: Show confirmation dialog before deleting a roar
         setting_display_media: Media display