diff options
author | Jason Goodman <jgoodman@gitlab.com> | 2019-04-09 06:52:15 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-04-09 06:52:15 +0000 |
commit | 5b7003282b6b3ce1bfc313b3271bd6827a230c34 (patch) | |
tree | 63ef06c4bb6b87acbcc56d39bdd944a58f06931a /app/controllers | |
parent | 74ac04a6aa7a9398ed908f47080e64ec40e0dee8 (diff) | |
download | gitlab-ce-5b7003282b6b3ce1bfc313b3271bd6827a230c34.tar.gz |
Set release name when adding release notes to an existing tag
Also set the release sha and author
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/tags/releases_controller.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/app/controllers/projects/tags/releases_controller.rb b/app/controllers/projects/tags/releases_controller.rb index 334e1847cc8..5e4c601a693 100644 --- a/app/controllers/projects/tags/releases_controller.rb +++ b/app/controllers/projects/tags/releases_controller.rb @@ -12,16 +12,13 @@ class Projects::Tags::ReleasesController < Projects::ApplicationController end def update - # Release belongs to Tag which is not active record object, - # it exists only to save a description to each Tag. - # If description is empty we should destroy the existing record. if release_params[:description].present? release.update(release_params) else release.destroy end - redirect_to project_tag_path(@project, @tag.name) + redirect_to project_tag_path(@project, tag.name) end private @@ -30,11 +27,10 @@ class Projects::Tags::ReleasesController < Projects::ApplicationController @tag ||= @repository.find_tag(params[:tag_id]) end - # rubocop: disable CodeReuse/ActiveRecord def release - @release ||= @project.releases.find_or_initialize_by(tag: @tag.name) + @release ||= Releases::CreateService.new(project, current_user, tag: @tag.name) + .find_or_build_release end - # rubocop: enable CodeReuse/ActiveRecord def release_params params.require(:release).permit(:description) |