summaryrefslogtreecommitdiff
path: root/app/controllers/projects/registry/tags_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/registry/tags_controller.rb')
-rw-r--r--app/controllers/projects/registry/tags_controller.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/projects/registry/tags_controller.rb b/app/controllers/projects/registry/tags_controller.rb
index e40489f67ad..8f0a1aff394 100644
--- a/app/controllers/projects/registry/tags_controller.rb
+++ b/app/controllers/projects/registry/tags_controller.rb
@@ -2,6 +2,26 @@ module Projects
module Registry
class TagsController < ::Projects::Registry::ApplicationController
before_action :authorize_update_container_image!, only: [:destroy]
+
+ def destroy
+ if tag.delete
+ redirect_to project_container_registry_path(@project)
+ else
+ redirect_to project_container_registry_path(@project),
+ alert: 'Failed to remove repository tag!'
+ end
+ end
+
+ private
+
+ def repository
+ @image ||= project.container_repositories
+ .find_by(id: params[:repository_id])
+ end
+
+ def tag
+ @tag ||= repository.tag(params[:id]) if params[:id].present?
+ end
end
end
end