版本发布的修改

forge
sylor_huang@126.com 5 years ago
parent 966af92b18
commit ebc639e48b

@ -329,7 +329,7 @@ class ApplicationController < ActionController::Base
def current_user
# User.current
if Rails.env.development?
user_id = 50207
user_id = 36390
else
user_id = 130328
end

@ -120,6 +120,8 @@ class PullRequestsController < ApplicationController
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
unless attachment.blank?
attachment.container = pull_issue
attachment.author_id = current_user.id
attachment.description = ""
attachment.save
end
end
@ -205,6 +207,8 @@ class PullRequestsController < ApplicationController
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
unless attachment.blank?
attachment.container = @issue
attachment.author_id = current_user.id
attachment.description = ""
attachment.save
end
end

@ -45,7 +45,6 @@ class VersionReleasesController < ApplicationController
@all_branches.push(b["name"])
end
end
end
def create
@ -53,6 +52,10 @@ class VersionReleasesController < ApplicationController
normal_status(-1, "名称不能为空")
elsif params[:tag_name].blank?
normal_status(-1, "标签名称不能为空")
elsif VersionRelease.exists?(tag_name: params[:tag_name], repository_id: @repository.id)
normal_status(-1, "该版本已存在")
elsif VersionRelease.exists?(name: params[:name], repository_id: @repository.id)
normal_status(-1, "该版本已存在")
else
ActiveRecord::Base.transaction do
begin
@ -60,7 +63,7 @@ class VersionReleasesController < ApplicationController
body: params[:body],
draft: params[:draft] || false,
name: params[:name],
prerelease: params[:prerelease],
prerelease: params[:prerelease] || false,
tag_name: params[:tag_name],
target_commitish: params[:target_commitish] || "master" #分支
}

@ -6,4 +6,5 @@ class PullRequest < ApplicationRecord
has_many :pull_request_assigns, foreign_key: :pull_request_id
has_many :pull_request_tags, foreign_key: :pull_request_id
has_many :project_trends, as: :trend, dependent: :destroy
has_many :attachments, as: :container, dependent: :destroy
end

@ -2,4 +2,5 @@ class VersionRelease < ApplicationRecord
belongs_to :repository
belongs_to :user
has_many :project_trends, as: :trend, dependent: :destroy
# has_many :attachments, as: :container, dependent: :destroy
end

Loading…
Cancel
Save