修改API(gitlab中创建所有pullrequest为Admin的问题)

This commit is contained in:
huang 2016-08-04 17:01:19 +08:00
parent 99fa39371d
commit 5419103268
3 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ class PullRequestsController < ApplicationController
source_branch = params[:source_branch]
target_branch = params[:target_branch]
begin
request = @g.create_merge_request(@project.gpid, title, :description => description, :source_branch => source_branch, :target_branch => target_branch)
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
respond_to do |format|
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
end

View File

@ -1,4 +1,4 @@
<% if @requests.nil? %>
<% if @requests.blank? %>
<div class="no-merge-content">没有可显示的请求</div>
<% else %>
<% @requests.each do |request| %>

View File

@ -43,11 +43,11 @@ class Gitlab::Client
# @option options [String] :target_branch (required) The target branch name.
# @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
def create_merge_request(project, title, options={})
def create_merge_request(project, title, gid, options={})
check_attributes!(options, [:source_branch, :target_branch])
body = {:title => title}.merge(options)
post("/projects/#{project}/merge_requests", :body => body)
post("/projects/#{project}/merge_requests?user_id=#{gid}", :body => body)
end
# Updates a merge request.