fix: pr title description validate

This commit is contained in:
yystopf 2022-05-06 14:29:05 +08:00
parent d44308fc82
commit 6aa3321d17
1 changed files with 2 additions and 1 deletions

View File

@ -58,6 +58,7 @@ class PullRequestsController < ApplicationController
def create
# return normal_status(-1, "您不是目标分支开发者,没有权限,请联系目标分支作者.") unless @project.operator?(current_user)
ActiveRecord::Base.transaction do
Issues::CreateForm.new({subject: params[:title], description: params}).validate!
@pull_request, @gitea_pull_request = PullRequests::CreateService.call(current_user, @owner, @project, params)
if @gitea_pull_request[:status] == :success
@pull_request.bind_gitea_pull_request!(@gitea_pull_request[:body]["number"], @gitea_pull_request[:body]["id"])
@ -89,7 +90,7 @@ class PullRequestsController < ApplicationController
else
ActiveRecord::Base.transaction do
begin
return normal_status(-1, "title不能超过255个字符") if params[:title].length > 255
Issues::UpdateForm.new({subject: params[:title], description: params[:body]}).validate!
merge_params
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?