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
bbd3fcf7
Commit
bbd3fcf7
authored
Jan 20, 2020
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not track `list_repositories` twice
parent
c976db76
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
app/controllers/groups/registry/repositories_controller.rb
app/controllers/groups/registry/repositories_controller.rb
+2
-2
app/controllers/projects/registry/repositories_controller.rb
app/controllers/projects/registry/repositories_controller.rb
+4
-3
spec/controllers/groups/registry/repositories_controller_spec.rb
...ntrollers/groups/registry/repositories_controller_spec.rb
+4
-1
spec/controllers/projects/registry/repositories_controller_spec.rb
...rollers/projects/registry/repositories_controller_spec.rb
+3
-1
No files found.
app/controllers/groups/registry/repositories_controller.rb
View file @
bbd3fcf7
...
...
@@ -7,13 +7,13 @@ module Groups
before_action
:feature_flag_group_container_registry_browser!
def
index
track_event
(
:list_repositories
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
@images
=
group
.
container_repositories
.
with_api_entity_associations
track_event
(
:list_repositories
)
render
json:
ContainerRepositoriesSerializer
.
new
(
current_user:
current_user
)
.
represent_read_only
(
@images
)
...
...
app/controllers/projects/registry/repositories_controller.rb
View file @
bbd3fcf7
...
...
@@ -7,12 +7,13 @@ module Projects
before_action
:ensure_root_container_repository!
,
only:
[
:index
]
def
index
@images
=
project
.
container_repositories
track_event
(
:list_repositories
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
@images
=
project
.
container_repositories
track_event
(
:list_repositories
)
render
json:
ContainerRepositoriesSerializer
.
new
(
project:
project
,
current_user:
current_user
)
.
represent
(
@images
)
...
...
spec/controllers/groups/registry/repositories_controller_spec.rb
View file @
bbd3fcf7
...
...
@@ -17,6 +17,8 @@ describe Groups::Registry::RepositoriesController do
context
'GET #index'
do
context
'when container registry is enabled'
do
it
'show index page'
do
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:event
)
get
:index
,
params:
{
group_id:
group
}
...
...
@@ -54,7 +56,8 @@ describe Groups::Registry::RepositoriesController do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
anything
,
'list_repositories'
,
{})
get
:index
,
params:
{
group_id:
group
group_id:
group
,
format: :json
}
end
end
...
...
spec/controllers/projects/registry/repositories_controller_spec.rb
View file @
bbd3fcf7
...
...
@@ -35,6 +35,8 @@ describe Projects::Registry::RepositoriesController do
end
it
'successfully renders container repositories'
do
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:event
)
go_to_index
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -43,7 +45,7 @@ describe Projects::Registry::RepositoriesController do
it
'tracks the event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
anything
,
'list_repositories'
,
{})
go_to_index
go_to_index
(
format: :json
)
end
it
'creates a root container repository'
do
...
...
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