BigW Consortium Gitlab

Commit 16335b3c by Sean McGivern

Merge branch 'issue_25578' into 'master'

Fix redirect after update file when user has forked project Closes #25578 See merge request !8371
parents c2173a14 781cca8d
...@@ -82,7 +82,7 @@ module CreatesCommit ...@@ -82,7 +82,7 @@ module CreatesCommit
return @merge_request if defined?(@merge_request) return @merge_request if defined?(@merge_request)
@merge_request = MergeRequestsFinder.new(current_user, project_id: @mr_target_project.id).execute.opened. @merge_request = MergeRequestsFinder.new(current_user, project_id: @mr_target_project.id).execute.opened.
find_by(source_branch: @mr_source_branch, target_branch: @mr_target_branch) find_by(source_branch: @mr_source_branch, target_branch: @mr_target_branch, source_project_id: @mr_source_project)
end end
def different_project? def different_project?
......
---
title: Fix redirect after update file when user has forked project
merge_request:
author:
require 'rails_helper' require 'rails_helper'
describe Projects::BlobController do describe Projects::BlobController do
let(:project) { create(:project) } let(:project) { create(:project, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
...@@ -84,5 +84,35 @@ describe Projects::BlobController do ...@@ -84,5 +84,35 @@ describe Projects::BlobController do
end end
end end
end end
context 'when user has forked project' do
let(:guest) { create(:user) }
let!(:forked_project) { Projects::ForkService.new(project, guest).execute }
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project, source_branch: "fork-test-1", target_branch: "master") }
before { sign_in(guest) }
it "redirects to forked project new merge request" do
default_params[:target_branch] = "fork-test-1"
default_params[:create_merge_request] = 1
allow_any_instance_of(Files::UpdateService).to receive(:commit).and_return(:success)
put :update, default_params
expect(response).to redirect_to(
new_namespace_project_merge_request_path(
forked_project.namespace,
forked_project,
merge_request: {
source_project_id: forked_project.id,
target_project_id: project.id,
source_branch: "fork-test-1",
target_branch: "master"
}
)
)
end
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment