2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Projects::Tags::ReleasesController < Projects::ApplicationController
|
|
|
|
# Authorize
|
|
|
|
before_action :require_non_empty_project
|
|
|
|
before_action :authorize_download_code!
|
|
|
|
before_action :authorize_push_code!
|
|
|
|
before_action :tag
|
|
|
|
before_action :release
|
|
|
|
|
|
|
|
def edit
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2020-04-08 14:13:33 +05:30
|
|
|
release.update(release_params) if release.persisted? || release_params[:description].present?
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
redirect_to project_tag_path(@project, tag.name)
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def tag
|
|
|
|
@tag ||= @repository.find_tag(params[:tag_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def release
|
2019-07-31 22:56:46 +05:30
|
|
|
@release ||= Releases::CreateService.new(project, current_user, tag: @tag.name)
|
|
|
|
.find_or_build_release
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def release_params
|
|
|
|
params.require(:release).permit(:description)
|
|
|
|
end
|
|
|
|
end
|