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
Jérome Perrin
gitlab-ce
Commits
f1f9b5e2
Commit
f1f9b5e2
authored
Jul 12, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be explicit on merge request discussion variables
parent
3ca92534
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
10 deletions
+41
-10
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+15
-10
spec/features/merge_requests/diffs_spec.rb
spec/features/merge_requests/diffs_spec.rb
+25
-0
No files found.
CHANGELOG
View file @
f1f9b5e2
...
...
@@ -56,6 +56,7 @@ v 8.10.0 (unreleased)
- Add API endpoint for a group issues !4520 (mahcsig)
- Add Bugzilla integration !4930 (iamtjg)
- Instrument Rinku usage
- Be explicit to define merge request discussion variables
- Metrics for Rouge::Plugins::Redcarpet and Rouge::Formatters::HTMLGitlab
- RailsCache metris now includes fetch_hit/fetch_miss and read_hit/read_miss info.
- Allow [ci skip] to be in any case and allow [skip ci]. !4785 (simon_w)
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
f1f9b5e2
...
...
@@ -56,7 +56,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
show
respond_to
do
|
format
|
format
.
html
format
.
html
{
define_discussion_vars
}
format
.
json
do
render
json:
@merge_request
...
...
@@ -82,7 +82,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff
=
@merge_request
.
merge_request_diff
respond_to
do
|
format
|
format
.
html
format
.
html
{
define_discussion_vars
}
format
.
json
{
render
json:
{
html:
view_to_html_string
(
"projects/merge_requests/show/_diffs"
)
}
}
end
end
...
...
@@ -108,7 +108,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
commits
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
format
.
html
do
define_discussion_vars
render
'show'
end
format
.
json
do
# Get commits from repository
# or from cache if already merged
...
...
@@ -123,7 +127,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
builds
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
format
.
html
do
define_discussion_vars
render
'show'
end
format
.
json
{
render
json:
{
html:
view_to_html_string
(
'projects/merge_requests/show/_builds'
)
}
}
end
end
...
...
@@ -353,14 +361,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
.
unlock_mr
@merge_request
.
close
end
if
request
.
format
==
:html
||
action_name
==
'show'
define_show_html_vars
end
end
# Discussion tab data is only required on html requests
def
define_show_html_vars
# Discussion tab data is rendered on html responses of actions
# :show, :diff, :commits, :builds. but not when request the data through AJAX
def
define_discussion_vars
# Build a note object for comment form
@note
=
@project
.
notes
.
new
(
noteable:
@noteable
)
...
...
spec/features/merge_requests/diffs_spec.rb
0 → 100644
View file @
f1f9b5e2
require
'spec_helper'
feature
'Diffs URL'
,
js:
true
,
feature:
true
do
before
do
login_as
:admin
@merge_request
=
create
(
:merge_request
)
@project
=
@merge_request
.
source_project
end
context
'when visit with */* as accept header'
do
before
(
:each
)
do
page
.
driver
.
add_header
(
'Accept'
,
'*/*'
)
end
it
'renders the notes'
do
create
:note_on_merge_request
,
project:
@project
,
noteable:
@merge_request
,
note:
'Rebasing with master'
visit
diffs_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
# Load notes and diff through AJAX
expect
(
page
).
to
have_css
(
'.note-text'
,
visible:
false
,
text:
'Rebasing with master'
)
expect
(
page
).
to
have_css
(
'.diffs.tab-pane.active'
)
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