summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-05-12 13:33:26 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-05-12 15:16:25 +0300
commit1028e05378f1fd25b49d95f36cf577a2b819844d (patch)
treedd8be4f2a610fc1f344cef3950087248c2aebdcd /app
parentf938f9441b908ed90c519f1ad208c68dcfb2dde2 (diff)
downloadgitlab-ce-1028e05378f1fd25b49d95f36cf577a2b819844d.tar.gz
Add parent full path to project list cache key
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r--app/helpers/projects_helper.rb11
-rw-r--r--app/models/namespace.rb4
2 files changed, 14 insertions, 1 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 78b54dc20e5..fd85217debf 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -157,7 +157,16 @@ module ProjectsHelper
end
def project_list_cache_key(project)
- key = [project.namespace.cache_key, project.cache_key, controller.controller_name, controller.action_name, current_application_settings.cache_key, 'v2.4']
+ key = [
+ 'parent/' + project.namespace.parent_full_path,
+ project.namespace.cache_key,
+ project.cache_key,
+ controller.controller_name,
+ controller.action_name,
+ current_application_settings.cache_key,
+ 'v2.4'
+ ]
+
key << pipeline_status_cache_key(project.pipeline_status) if project.pipeline_status.has_status?
key
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index a7ede5e3b9e..cf82b56cc7a 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -224,6 +224,10 @@ class Namespace < ActiveRecord::Base
parent.present?
end
+ def parent_full_path
+ full_path.split('/')[0...-1].join('/')
+ end
+
private
def repository_storage_paths