about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2017-11-16 00:05:20 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-11-15 16:05:20 +0100
commit19e8b861a2c97240e0ca9c47d13bb3d7c5cb7520 (patch)
treefad5e2ed7fbc5829ed26f71488332d9b7e3a6cb1 /app
parent7d7df877ef042cda2095f35061d65a9051ad987b (diff)
Delegate some methods of User to @settings (#5706)
* Move some tests of User into Settings::ScopedSettings

* Add a test for User@settings
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb40
1 files changed, 4 insertions, 36 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index ebe768c52..326b871a1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -73,6 +73,10 @@ class User < ApplicationRecord
 
   has_many :session_activations, dependent: :destroy
 
+  delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal,
+           :reduce_motion, :system_font_ui, :noindex, :theme,
+           to: :settings, prefix: :setting, allow_nil: false
+
   def confirmed?
     confirmed_at.present?
   end
@@ -136,42 +140,6 @@ class User < ApplicationRecord
     settings.default_privacy || (account.locked? ? 'private' : 'public')
   end
 
-  def setting_default_sensitive
-    settings.default_sensitive
-  end
-
-  def setting_unfollow_modal
-    settings.unfollow_modal
-  end
-
-  def setting_boost_modal
-    settings.boost_modal
-  end
-
-  def setting_delete_modal
-    settings.delete_modal
-  end
-
-  def setting_auto_play_gif
-    settings.auto_play_gif
-  end
-
-  def setting_reduce_motion
-    settings.reduce_motion
-  end
-
-  def setting_system_font_ui
-    settings.system_font_ui
-  end
-
-  def setting_noindex
-    settings.noindex
-  end
-
-  def setting_theme
-    settings.theme
-  end
-
   def token_for_app(a)
     return nil if a.nil? || a.owner != self
     Doorkeeper::AccessToken