Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
781cca8d
Commit
781cca8d
authored
Dec 29, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix redirect after update file when user has forked project
parent
713a1e28
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+1
-1
changelogs/unreleased/issue_25578.yml
changelogs/unreleased/issue_25578.yml
+4
-0
spec/controllers/projects/blob_controller_spec.rb
spec/controllers/projects/blob_controller_spec.rb
+31
-1
No files found.
app/controllers/concerns/creates_commit.rb
View file @
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?
...
...
changelogs/unreleased/issue_25578.yml
0 → 100644
View file @
781cca8d
---
title
:
Fix redirect after update file when user has forked project
merge_request
:
author
:
spec/controllers/projects/blob_controller_spec.rb
View file @
781cca8d
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment