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

use cache_key_with_version to adapt to changed cache_key method

ulferts8018cc060b32
diff --git a/app/models/query.rb b/app/models/query.rb
index 47eabd5b19d..4464c41d803 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -211,11 +211,11 @@ class Query < ApplicationRecord
def available_columns
if @available_columns &&
- (@available_columns_project == (project&.cache_key || 0))
+ (@available_columns_project == (project&.cache_key_with_version || 0))
return @available_columns
end
- @available_columns_project = project&.cache_key || 0
+ @available_columns_project = project&.cache_key_with_version || 0
@available_columns = ::Query.available_columns(project)
end
diff --git a/lib/api/v3/queries/columns/query_relation_to_type_column_representer.rb b/lib/api/v3/queries/columns/query_relation_to_type_column_representer.rb
index 53a4255c9cd..db62ccf4e0e 100644
--- a/lib/api/v3/queries/columns/query_relation_to_type_column_representer.rb
+++ b/lib/api/v3/queries/columns/query_relation_to_type_column_representer.rb
@@ -43,7 +43,7 @@ module API
end
def json_cache_key
- [represented.name, represented.type.cache_key]
+ [represented.name, represented.type.cache_key_with_version]
end
end
end
diff --git a/lib/api/v3/queries/schemas/custom_field_json_cache_key_mixin.rb b/lib/api/v3/queries/schemas/custom_field_json_cache_key_mixin.rb
index 34acd010b8c..1448e3c3891 100644
--- a/lib/api/v3/queries/schemas/custom_field_json_cache_key_mixin.rb
+++ b/lib/api/v3/queries/schemas/custom_field_json_cache_key_mixin.rb
@@ -36,7 +36,7 @@ module API
alias :orig_json_cache_key :json_cache_key
def json_cache_key
- orig_json_cache_key + [filter.custom_field.cache_key]
+ orig_json_cache_key + [filter.custom_field.cache_key_with_version]
end
end
end
diff --git a/modules/auth_saml/lib/open_project/auth_saml/engine.rb b/modules/auth_saml/lib/open_project/auth_saml/engine.rb
index 455ac439112..ea3dafc4dde 100644
--- a/modules/auth_saml/lib/open_project/auth_saml/engine.rb
+++ b/modules/auth_saml/lib/open_project/auth_saml/engine.rb
@@ -4,7 +4,7 @@ module OpenProject
def self.configuration
providers = Saml::Provider.where(available: true)
- OpenProject::Cache.fetch(providers.cache_key) do
+ OpenProject::Cache.fetch(providers.cache_key_with_version) do
providers.each_with_object({}) do |provider, hash|
hash[provider.slug.to_sym] = provider.to_h
end
diff --git a/modules/openid_connect/lib/open_project/openid_connect.rb b/modules/openid_connect/lib/open_project/openid_connect.rb
index 2c8df881e6c..c6c5cec912a 100644
--- a/modules/openid_connect/lib/open_project/openid_connect.rb
+++ b/modules/openid_connect/lib/open_project/openid_connect.rb
@@ -7,7 +7,7 @@ module OpenProject
def self.configuration
providers = ::OpenIDConnect::Provider.where(available: true)
- OpenProject::Cache.fetch(providers.cache_key) do
+ OpenProject::Cache.fetch(providers.cache_key_with_version) do
providers.each_with_object({}) do |provider, hash|
hash[provider.slug.to_sym] = provider.to_h
end
diff --git a/spec/models/issue_priority_spec.rb b/spec/models/issue_priority_spec.rb
index 6371173082c..ab1f9c389bf 100644
--- a/spec/models/issue_priority_spec.rb
+++ b/spec/models/issue_priority_spec.rb
@@ -64,13 +64,13 @@ RSpec.describe IssuePriority do
end
end
- describe "#cache_key" do
+ describe "#cache_key_with_version" do
it "updates when the updated_at field changes" do
- old_cache_key = stubbed_priority.cache_key
+ old_cache_key = stubbed_priority.cache_key_with_version
- stubbed_priority.updated_at = Time.now
+ stubbed_priority.updated_at = Time.zone.now
- expect(stubbed_priority.cache_key)
+ expect(stubbed_priority.cache_key_with_version)
.not_to eql old_cache_key
end
end
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index a21e3d9b286..a41527f63f5 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -86,13 +86,13 @@ RSpec.describe Status do
end
end
- describe "#cache_key" do
+ describe "#cache_key_with_version" do
it "updates when the updated_at field changes" do
- old_cache_key = stubbed_status.cache_key
+ old_cache_key = stubbed_status.cache_key_with_version
stubbed_status.updated_at = Time.zone.now
- expect(stubbed_status.cache_key)
+ expect(stubbed_status.cache_key_with_version)
.not_to eql old_cache_key
end
end