From ecc6f5601ea3da9b91fef30b1e8513959374e3ce Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Aug 2016 20:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=97=E8=AF=B7=E6=B1=82=E5=90=8E?= =?UTF-8?q?=E6=98=BE=E7=A4=BAadmin=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 2 +- app/views/pull_requests/_form.html.erb | 22 +++++++++++++++++-- .../lib/gitlab/client/merge_requests.rb | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 7db6e592e..58d1cb3b2 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -98,7 +98,7 @@ class PullRequestsController < ApplicationController # @return [Gitlab::ObjectifiedHash] def accept_pull_request begin - status = @g.accept_merge_rquest(@project.gpid, params[:id]) + status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid) respond_to do |format| format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)} end diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb index 52e3ed20a..d5de31723 100644 --- a/app/views/pull_requests/_form.html.erb +++ b/app/views/pull_requests/_form.html.erb @@ -9,11 +9,11 @@
源分支
- <%= select_tag :branch, options_for_select(@source_rev), :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %> + <%= select_tag :branch, options_for_select(@source_rev), :id => "source_branch", :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %>
目标分支
<% if @forked_project.nil? %> - <%= select_tag :branch, options_for_select(@source_rev), :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;", :id => "targetBranch" %> + <%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %> <% else %> <% end %>
+ +
提交请求 @@ -50,6 +52,22 @@ } } + function regex_branch() + { + var source_branch = $.trim($("#source_branch").val()); + var target_branch = $.trim($("#pull_request_branch").val()); + if(source_branch == target_branch) + { + $("#pull_request_branch_error").show(); + return false; + } + else + { + $("#pull_request_branch_error").hide(); + return true; + } + } + //提交pull request function pull_request_commit() { diff --git a/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb b/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb index 17b12cdaa..2006c58bf 100644 --- a/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb +++ b/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb @@ -118,8 +118,8 @@ class Gitlab::Client # @param [Integer] project The ID of a project. # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] - def accept_merge_rquest(project, id) - put("/projects/#{project}/merge_request/#{id}/merge") + def accept_merge_rquest(project, id, gid) + put("/projects/#{project}/merge_request/#{id}/merge?user_id=#{gid}") end private