Merge commit '55e7c08a83547424024bac311d5459cb82cf6dae' into glitch-soc/merge-upstream
Conflicts: - `app/models/user_settings.rb`: Upstream added a constraint on a setting textually close to glitch-soc-only settings. Applied upstream's change. - `lib/sanitize_ext/sanitize_config.rb`: Upstream added support for the `translate` attribute on a few elements, where glitch-soc had a different set of allowed elements and attributes. Extended glitch-soc's allowed attributes with `translate` as upstream did. - `spec/validators/status_length_validator_spec.rb`: Upstream refactored to use RSpec's `instance_double` instead of `double`, but glitch-soc had changes to tests due to configurable max toot chars. Applied upstream's changes while keeping tests against configurable max toot chars.
This commit is contained in:
@@ -15,7 +15,7 @@ class UserSettings
|
||||
setting :show_application, default: true
|
||||
setting :default_language, default: nil
|
||||
setting :default_sensitive, default: false
|
||||
setting :default_privacy, default: nil
|
||||
setting :default_privacy, default: nil, in: %w(public unlisted private)
|
||||
setting :default_content_type, default: 'text/plain'
|
||||
setting :hide_followers_count, default: false
|
||||
|
||||
@@ -79,7 +79,10 @@ class UserSettings
|
||||
|
||||
raise KeyError, "Undefined setting: #{key}" unless self.class.definition_for?(key)
|
||||
|
||||
typecast_value = self.class.definition_for(key).type_cast(value)
|
||||
setting_definition = self.class.definition_for(key)
|
||||
typecast_value = setting_definition.type_cast(value)
|
||||
|
||||
raise ArgumentError, "Invalid value for setting #{key}: #{typecast_value}" if setting_definition.in.present? && setting_definition.in.exclude?(typecast_value)
|
||||
|
||||
if typecast_value.nil?
|
||||
@original_hash.delete(key)
|
||||
|
Reference in New Issue
Block a user