Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1028e053
Commit
1028e053
authored
May 12, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parent full path to project list cache key
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
f938f944
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
1 deletion
+30
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+10
-1
app/models/namespace.rb
app/models/namespace.rb
+4
-0
changelogs/unreleased/dz-project-list-cache-key.yml
changelogs/unreleased/dz-project-list-cache-key.yml
+4
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+6
-0
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+6
-0
No files found.
app/helpers/projects_helper.rb
View file @
1028e053
...
...
@@ -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
...
...
app/models/namespace.rb
View file @
1028e053
...
...
@@ -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
...
...
changelogs/unreleased/dz-project-list-cache-key.yml
0 → 100644
View file @
1028e053
---
title
:
Add parent full path to project list cache key
merge_request
:
11325
author
:
spec/helpers/projects_helper_spec.rb
View file @
1028e053
...
...
@@ -70,6 +70,12 @@ describe ProjectsHelper do
expect
(
helper
.
project_list_cache_key
(
project
)).
to
include
(
project
.
namespace
.
cache_key
)
end
it
"includes the parent namespace in case of subgroup"
do
project
=
create
(
:project
,
group:
create
(
:group
,
:nested
))
expect
(
helper
.
project_list_cache_key
(
project
)).
to
include
(
"parent/
#{
project
.
namespace
.
parent
.
path
}
"
)
end
it
"includes the project"
do
expect
(
helper
.
project_list_cache_key
(
project
)).
to
include
(
project
.
cache_key
)
end
...
...
spec/models/namespace_spec.rb
View file @
1028e053
...
...
@@ -332,4 +332,10 @@ describe Namespace, models: true do
it
{
expect
(
group
.
all_projects
.
to_a
).
to
eq
([
project2
,
project1
])
}
end
describe
'#parent_full_path'
do
let
(
:namespace
)
{
create
(
:group
,
:nested
)
}
it
{
expect
(
namespace
.
parent_full_path
).
to
eq
(
namespace
.
parent
.
path
)
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment