fix: valid pr title length

This commit is contained in:
yystopf 2021-12-20 13:47:32 +08:00
parent 29f98513e2
commit aa60de1dac
2 changed files with 2 additions and 0 deletions

View File

@ -89,6 +89,7 @@ class PullRequestsController < ApplicationController
else
ActiveRecord::Base.transaction do
begin
return normal_status(-1, "title不能超过255个字符") if params[:title].length > 255
merge_params
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?

View File

@ -148,6 +148,7 @@ class PullRequests::CreateService < ApplicationService
def validate!
raise "title参数不能为空" if @params[:title].blank?
raise "title不能超过255个字符" if @params[:title].length > 255
raise "head参数不能为空" if @params[:head].blank?
raise "base参数不能为空" if @params[:base].blank?
raise "fork_project_id参数错误" if is_original && !@project.forked_projects.pluck(:id).include?(@params[:fork_project_id].to_i)