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

fixed cache key so it works in spec too

Markus Kahlb8c04551b84b
diff --git a/app/models/setting.rb b/app/models/setting.rb
index b3d12a722af..3d7757d7256 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -285,11 +285,21 @@ class Setting < ApplicationRecord
end
def self.cache_key
- RequestStore.store[:settings_updated_at] ||= Setting.column_names.include?(:updated_at) && Setting.maximum(:updated_at)
- most_recent_settings_change = (RequestStore.store[:settings_updated_at] || Time.now.utc).to_i
+ most_recent_settings_change = (settings_updated_at || Time.now.utc).to_i
+
"/openproject/settings/all/#{most_recent_settings_change}"
end
+ def self.settings_updated_at
+ RequestStore.store[:settings_updated_at] ||= has_updated_at_column? && Setting.maximum(:updated_at)
+ end
+
+ def self.has_updated_at_column?
+ return @has_updated_at_column unless @has_updated_at_column.nil?
+
+ @has_updated_at_column = Setting.column_names.map(&:to_sym).include?(:updated_at)
+ end
+
def self.settings_table_exists_yet?
# Check whether the settings table already exists. This makes plugins
# patching core classes not break things when settings are accessed.