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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ca4a59e3
Commit
ca4a59e3
authored
Jan 11, 2018
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error on changes tab when merge request cannot be created
parent
34760245
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
23 deletions
+36
-23
app/controllers/projects/merge_requests/creations_controller.rb
...ntrollers/projects/merge_requests/creations_controller.rb
+1
-5
app/views/projects/merge_requests/creations/_diffs.html.haml
app/views/projects/merge_requests/creations/_diffs.html.haml
+5
-1
changelogs/unreleased/issue_41460.yml
changelogs/unreleased/issue_41460.yml
+5
-0
spec/controllers/projects/merge_requests/creations_controller_spec.rb
...lers/projects/merge_requests/creations_controller_spec.rb
+25
-17
No files found.
app/controllers/projects/merge_requests/creations_controller.rb
View file @
ca4a59e3
...
@@ -43,11 +43,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
...
@@ -43,11 +43,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
end
end
def
diffs
def
diffs
@diffs
=
if
@merge_request
.
can_be_created
@diffs
=
@merge_request
.
diffs
(
diff_options
)
if
@merge_request
.
can_be_created
@merge_request
.
diffs
(
diff_options
)
else
[]
end
@diff_notes_disabled
=
true
@diff_notes_disabled
=
true
...
...
app/views/projects/merge_requests/creations/_diffs.html.haml
View file @
ca4a59e3
=
render
"projects/diffs/diffs"
,
diffs:
@diffs
,
environment:
@environment
,
show_whitespace_toggle:
false
-
if
@merge_request
.
can_be_created
=
render
"projects/diffs/diffs"
,
diffs:
@diffs
,
environment:
@environment
,
show_whitespace_toggle:
false
-
else
.nothing-here-block
This merge request cannot be created.
changelogs/unreleased/issue_41460.yml
0 → 100644
View file @
ca4a59e3
---
title
:
Fix error on changes tab when merge request cannot be created
merge_request
:
author
:
type
:
fixed
spec/controllers/projects/merge_requests/creations_controller_spec.rb
View file @
ca4a59e3
...
@@ -4,6 +4,16 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -4,6 +4,16 @@ describe Projects::MergeRequests::CreationsController do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
owner
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:get_diff_params
)
do
{
namespace_id:
fork_project
.
namespace
.
to_param
,
project_id:
fork_project
,
merge_request:
{
source_branch:
'remove-submodule'
,
target_branch:
'master'
}
}
end
before
do
before
do
fork_project
.
add_master
(
user
)
fork_project
.
add_master
(
user
)
...
@@ -13,22 +23,27 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -13,22 +23,27 @@ describe Projects::MergeRequests::CreationsController do
describe
'GET new'
do
describe
'GET new'
do
context
'merge request that removes a submodule'
do
context
'merge request that removes a submodule'
do
render_views
it
'renders new merge request widget template'
do
it
'renders new merge request widget template'
do
get
:new
,
get
:new
,
get_diff_params
namespace_id:
fork_project
.
namespace
.
to_param
,
project_id:
fork_project
,
merge_request:
{
source_branch:
'remove-submodule'
,
target_branch:
'master'
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
end
end
end
end
end
end
describe
'GET diffs'
do
context
'when merge request cannot be created'
do
it
'does not assign diffs var'
do
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:can_be_created
).
and_return
(
false
)
get
:diffs
,
get_diff_params
.
merge
(
format:
'json'
)
expect
(
response
).
to
be_success
expect
(
assigns
[
:diffs
]).
to
be_nil
end
end
end
describe
'GET pipelines'
do
describe
'GET pipelines'
do
before
do
before
do
create
(
:ci_pipeline
,
sha:
fork_project
.
commit
(
'remove-submodule'
).
id
,
create
(
:ci_pipeline
,
sha:
fork_project
.
commit
(
'remove-submodule'
).
id
,
...
@@ -37,14 +52,7 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -37,14 +52,7 @@ describe Projects::MergeRequests::CreationsController do
end
end
it
'renders JSON including serialized pipelines'
do
it
'renders JSON including serialized pipelines'
do
get
:pipelines
,
get
:pipelines
,
get_diff_params
.
merge
(
format:
'json'
)
namespace_id:
fork_project
.
namespace
.
to_param
,
project_id:
fork_project
,
merge_request:
{
source_branch:
'remove-submodule'
,
target_branch:
'master'
},
format: :json
expect
(
response
).
to
be_ok
expect
(
response
).
to
be_ok
expect
(
json_response
).
to
have_key
'pipelines'
expect
(
json_response
).
to
have_key
'pipelines'
...
...
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