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:
@ -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)
|
||||
|
Reference in New Issue
Block a user