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

Improve code design

parent e53d9b8fc189
......@@ -8,10 +8,12 @@ def index
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 @@ def repository
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,9 +349,9 @@ def container_registry_repository_url
end
def has_container_registry_tags?
if Gitlab.config.registry.enabled
container_registry_repository.tags.any?
end
return unless container_registry_repository
container_registry_repository.tags.any?
end
def commit(id = 'HEAD')
......
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