Browse Source

fix: valid pr title length

tags/v4.0.0^2
yystopf 4 years ago
parent
commit
aa60de1dac
2 changed files with 2 additions and 0 deletions
  1. +1
    -0
      app/controllers/pull_requests_controller.rb
  2. +1
    -0
      app/services/pull_requests/create_service.rb

+ 1
- 0
app/controllers/pull_requests_controller.rb 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?


+ 1
- 0
app/services/pull_requests/create_service.rb 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)


Loading…
Cancel
Save