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

Improvement #5

Dombi Attila53b77fadff2c
diff --git a/lib/api/v3/utilities/path_helper.rb b/lib/api/v3/utilities/path_helper.rb
index 499ec95eac2..7ef5721240e 100644
--- a/lib/api/v3/utilities/path_helper.rb
+++ b/lib/api/v3/utilities/path_helper.rb
@@ -41,7 +41,7 @@ module API
path ||= plural_name
define_singleton_method(plural_name) do
- "#{root}/#{path}"
+ RequestStore.store[:"cached_#{plural_name}"] ||= "#{root}/#{path}"
end
end
private_class_method :index
@@ -52,7 +52,9 @@ module API
private_class_method :show
def self.create_form(name)
- define_singleton_method(:"create_#{name}_form") { build_path(name, "form") }
+ define_singleton_method(:"create_#{name}_form") do
+ RequestStore.store[:"cached_create_#{name}_form"] ||= build_path(name, "form")
+ end
end
private_class_method :create_form
@@ -62,7 +64,9 @@ module API
private_class_method :update_form
def self.schema(name)
- define_singleton_method(:"#{name}_schema") { build_path(name, "schema") }
+ define_singleton_method(:"#{name}_schema") do
+ RequestStore.store[:"cached_#{name}_schema"] ||= build_path(name, "schema")
+ end
end
private_class_method :schema
@@ -89,7 +93,7 @@ module API
end
def self.root
- "#{root_path}api/v3"
+ RequestStore.store[:cached_root] ||= "#{root_path}api/v3"
end
def self.same_origin?(url)