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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
8294756f
Commit
8294756f
authored
Jan 25, 2017
by
Andre Guedes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved readability in tag/image delete condition
parent
ea17df5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
app/controllers/projects/container_registry_controller.rb
app/controllers/projects/container_registry_controller.rb
+17
-11
No files found.
app/controllers/projects/container_registry_controller.rb
View file @
8294756f
...
...
@@ -9,31 +9,37 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
end
def
destroy
url
=
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
if
tag
delete_tag
(
url
)
else
if
image
.
destroy
redirect_to
url
delete_tag
else
redirect_to
url
,
alert:
'Failed to remove image'
end
delete_image
end
end
private
def
registry_url
@registry_url
||=
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
end
def
verify_registry_enabled
render_404
unless
Gitlab
.
config
.
registry
.
enabled
end
def
delete_tag
(
url
)
def
delete_image
if
image
.
destroy
redirect_to
registry_url
else
redirect_to
registry_url
,
alert:
'Failed to remove image'
end
end
def
delete_tag
if
tag
.
delete
image
.
destroy
if
image
.
tags
.
empty?
redirect_to
url
redirect_to
registry_
url
else
redirect_to
url
,
alert:
'Failed to remove tag'
redirect_to
registry_
url
,
alert:
'Failed to remove tag'
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