#472: Update Projects::PullRequestsController
This commit is contained in:
parent
592eed5640
commit
81ddbef53a
|
@ -34,7 +34,7 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
to_project = find_destination_project
|
||||
authorize to_project, :show?
|
||||
|
||||
@pull = to_project.pull_requests.new pull_params
|
||||
@pull = to_project.pull_requests.build pull_params
|
||||
@issue = @pull.issue
|
||||
@pull.issue.assignee_id = (params[:issue] || {})[:assignee_id] if policy(to_project).write?
|
||||
@pull.issue.user, @pull.issue.project, @pull.from_project = current_user, to_project, @project
|
||||
|
@ -131,7 +131,7 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def pull_params
|
||||
@pull_params ||= params[:pull_request].presence
|
||||
@pull_params ||= subject_params(PullRequest).presence
|
||||
end
|
||||
|
||||
def json_for_autocomplete_base items
|
||||
|
|
|
@ -29,10 +29,9 @@ class PullRequestPolicy < ApplicationPolicy
|
|||
%i(
|
||||
body
|
||||
from_ref
|
||||
issue_attributes
|
||||
title
|
||||
to_ref
|
||||
)
|
||||
) + [ issue_attributes: %i(title body) ]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ shared_examples_for 'pull request user with project reader rights' do
|
|||
|
||||
it "should create pull request to the same project" do
|
||||
@parent = FactoryGirl.create(:project)
|
||||
@project.update_attributes({parent_id: @parent}, without_protection: true)
|
||||
@project.update_attributes(parent_id: @parent)
|
||||
|
||||
expect do
|
||||
post :create, @create_params
|
||||
|
@ -77,7 +77,7 @@ shared_examples_for 'pull request user with project reader rights' do
|
|||
|
||||
it "should create pull request to the parent project" do
|
||||
@parent = FactoryGirl.create(:project_with_commit)
|
||||
@project.update_attributes({parent_id: @parent}, without_protection: true)
|
||||
@project.update_attributes(parent_id: @parent)
|
||||
|
||||
expect do
|
||||
post :create, @create_params.merge({to_project: @parent.name_with_owner})
|
||||
|
|
Loading…
Reference in New Issue