about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-02-09 00:26:57 +0100
committerGitHub <noreply@github.com>2018-02-09 00:26:57 +0100
commit76f3d5d16be2fb97d2252909589510165ec05e12 (patch)
treee46a34d048183f23e5d13dbdda9a0922e86a271f /app/lib
parent1167c6dbf8d5b8411d9924350b2b9735da6d9d26 (diff)
Add preference to always display sensitive media (#6448)
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/user_settings_decorator.rb29
1 files changed, 17 insertions, 12 deletions
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index d48e1da65..4d6f19467 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -15,18 +15,19 @@ 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_sensitive']   = default_sensitive_preference if change?('setting_default_sensitive')
-    user.settings['unfollow_modal']      = unfollow_modal_preference if change?('setting_unfollow_modal')
-    user.settings['boost_modal']         = boost_modal_preference if change?('setting_boost_modal')
-    user.settings['delete_modal']        = delete_modal_preference if change?('setting_delete_modal')
-    user.settings['auto_play_gif']       = auto_play_gif_preference if change?('setting_auto_play_gif')
-    user.settings['reduce_motion']       = reduce_motion_preference if change?('setting_reduce_motion')
-    user.settings['system_font_ui']      = system_font_ui_preference if change?('setting_system_font_ui')
-    user.settings['noindex']             = noindex_preference if change?('setting_noindex')
-    user.settings['theme']               = theme_preference if change?('setting_theme')
+    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['unfollow_modal']          = unfollow_modal_preference if change?('setting_unfollow_modal')
+    user.settings['boost_modal']             = boost_modal_preference if change?('setting_boost_modal')
+    user.settings['delete_modal']            = delete_modal_preference if change?('setting_delete_modal')
+    user.settings['auto_play_gif']           = auto_play_gif_preference if change?('setting_auto_play_gif')
+    user.settings['display_sensitive_media'] = display_sensitive_media_preference if change?('setting_display_sensitive_media')
+    user.settings['reduce_motion']           = reduce_motion_preference if change?('setting_reduce_motion')
+    user.settings['system_font_ui']          = system_font_ui_preference if change?('setting_system_font_ui')
+    user.settings['noindex']                 = noindex_preference if change?('setting_noindex')
+    user.settings['theme']                   = theme_preference if change?('setting_theme')
   end
 
   def merged_notification_emails
@@ -65,6 +66,10 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_auto_play_gif'
   end
 
+  def display_sensitive_media_preference
+    boolean_cast_setting 'setting_display_sensitive_media'
+  end
+
   def reduce_motion_preference
     boolean_cast_setting 'setting_reduce_motion'
   end