Enable updating additional account information from user preferences via rest api (#6789)
* Enable updating additional account information from user preferences via rest api Resolves #6553 * Pacify rubocop * Decoerce incoming settings in UserSettingsDecorator * Create user preferences hash directly from incoming credentials instead of going through ActionController::Parameters * Clean up user preferences update * Use ActiveModel::Type::Boolean instead of manually checking stringified number equivalence
This commit is contained in:
parent
1364e9e4ae
commit
cd0eaa349c
4 changed files with 31 additions and 2 deletions
|
@ -83,7 +83,7 @@ class UserSettingsDecorator
|
|||
end
|
||||
|
||||
def boolean_cast_setting(key)
|
||||
settings[key] == '1'
|
||||
ActiveModel::Type::Boolean.new.cast(settings[key])
|
||||
end
|
||||
|
||||
def coerced_settings(key)
|
||||
|
@ -91,7 +91,7 @@ class UserSettingsDecorator
|
|||
end
|
||||
|
||||
def coerce_values(params_hash)
|
||||
params_hash.transform_values { |x| x == '1' }
|
||||
params_hash.transform_values { |x| ActiveModel::Type::Boolean.new.cast(x) }
|
||||
end
|
||||
|
||||
def change?(key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue