Commit 2f1cb7ce authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve code design

parent 24145592
......@@ -8,10 +8,12 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
end
def destroy
url = namespace_project_container_registry_index_path(project.namespace, project)
if tag.delete
redirect_to namespace_project_container_registry_index_path(project.namespace, project)
redirect_to url
else
redirect_to namespace_project_container_registry_index_path(project.namespace, project), alert: 'Failed to remove tag'
redirect_to url, alert: 'Failed to remove tag'
end
end
......
......@@ -331,6 +331,8 @@ class Project < ActiveRecord::Base
end
def container_registry_repository
return unless Gitlab.config.registry.enabled
@container_registry_repository ||= begin
token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace)
url = Gitlab.config.registry.api_url
......@@ -347,10 +349,10 @@ class Project < ActiveRecord::Base
end
def has_container_registry_tags?
if Gitlab.config.registry.enabled
return unless container_registry_repository
container_registry_repository.tags.any?
end
end
def commit(id = 'HEAD')
repository.commit(id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment