Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tags_controller.rb « registry « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aab130787e90910bd0c880ea29c4e2a05199c1d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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),
                      notice: 'Tag removed successfull!'
        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