Skip to content

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

Remove `Setting.definitions`.

Pavel Balashovfc63e5a65c69
diff --git a/app/models/permitted_params/allowed_settings.rb b/app/models/permitted_params/allowed_settings.rb
index 45c04d8ac38..67b496ab164 100644
--- a/app/models/permitted_params/allowed_settings.rb
+++ b/app/models/permitted_params/allowed_settings.rb
@@ -20,7 +20,7 @@ class PermittedParams
module_function
def all
- keys = Setting.definitions.keys
+ keys = Settings::Definition.all.keys
restrictions.select(&:applicable?).each do |restriction|
restricted_keys = restriction.restricted_keys
diff --git a/app/models/setting.rb b/app/models/setting.rb
index 99248c188f6..5d7e9acd169 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -116,10 +116,6 @@ class Setting < ApplicationRecord
class_eval src, __FILE__, __LINE__
end
- def definitions
- Settings::Definition.all
- end
-
def method_missing(method, *args, &)
if exists?(accessor_base_name(method))
create_setting_accessors(accessor_base_name(method))
diff --git a/app/seeders/basic_data/setting_seeder.rb b/app/seeders/basic_data/setting_seeder.rb
index 8ee3efbdddf..01249e9ea6c 100644
--- a/app/seeders/basic_data/setting_seeder.rb
+++ b/app/seeders/basic_data/setting_seeder.rb
@@ -66,10 +66,11 @@ module BasicData
private
def seedable_setting_definitions
- Setting.definitions
- .values
- .select(&:writable?)
- .reject { |definition| definition.value.nil? }
+ Settings::Definition
+ .all
+ .values
+ .select(&:writable?)
+ .reject { |definition| definition.value.nil? }
end
def settings_in_db