OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
refactor: fix naming and make rubocop happier
Christophe Bliard23e95dd3c9ba
diff --git a/app/models/setting.rb b/app/models/setting.rbindex bf013df9e58..5888f26e1e5 100644--- a/app/models/setting.rb+++ b/app/models/setting.rb@@ -141,8 +141,8 @@ class Setting < ApplicationRecordendend- validates_uniqueness_of :namevalidates :name,+ uniqueness: true,inclusion: {in: ->(*) { Settings::Definition.all.map(&:name) } # @available_settings change at runtime}@@ -179,10 +179,10 @@ class Setting < ApplicationRecordcached_or_default(name)end- def self.[]=(name, v)+ def self.[]=(name, value)old_setting = cached_or_default(name)new_setting = find_or_initialize_by(name: name)- new_setting.value = v+ new_setting.value = value# Keep the current cache key,# since updated_at will change after .save@@ -290,7 +290,7 @@ class Setting < ApplicationRecorddef self.cached_settingsRequestStore.fetch(:cached_settings) doRails.cache.fetch(cache_key) do- Hash[Setting.pluck(:name, :value)]+ Setting.pluck(:name, :value).to_hendendend@@ -321,15 +321,15 @@ class Setting < ApplicationRecordend# Unserialize a serialized settings value- def self.deserialize(name, v)- default = Settings::Definition[name]+ def self.deserialize(name, value)+ definition = Settings::Definition[name]- if default.serialized? && v.is_a?(String)- YAML::safe_load(v, permitted_classes: [Symbol, ActiveSupport::HashWithIndifferentAccess, Date, Time])- elsif v.present?- read_formatted_setting v, default.format+ if definition.serialized? && value.is_a?(String)+ YAML::safe_load(value, permitted_classes: [Symbol, ActiveSupport::HashWithIndifferentAccess, Date, Time])+ elsif value.present?+ read_formatted_setting value, definition.formatelse- v+ valueendend