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
Léo-Paul Géneau
gitlab-ce
Commits
8ab3ab9e
Commit
8ab3ab9e
authored
Jul 07, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't render discussion notes when requesting diff tab through AJAX
parent
0de61777
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
24 deletions
+35
-24
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+32
-22
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+2
-2
No files found.
CHANGELOG
View file @
8ab3ab9e
...
@@ -45,6 +45,7 @@ v 8.10.0 (unreleased)
...
@@ -45,6 +45,7 @@ v 8.10.0 (unreleased)
- RailsCache metris now includes fetch_hit/fetch_miss and read_hit/read_miss info.
- 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)
- Allow [ci skip] to be in any case and allow [skip ci]. !4785 (simon_w)
- Set import_url validation to be more strict
- Set import_url validation to be more strict
- Don't render discussion notes when requesting diff tab through AJAX
- Add basic system information like memory and disk usage to the admin panel
- Add basic system information like memory and disk usage to the admin panel
- Don't garbage collect commits that have related DB records like comments
- Don't garbage collect commits that have related DB records like comments
- More descriptive message for git hooks and file locks
- More descriptive message for git hooks and file locks
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
8ab3ab9e
...
@@ -53,9 +53,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -53,9 +53,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
show
def
show
@note_counts
=
Note
.
where
(
commit_id:
@merge_request
.
commits
.
map
(
&
:id
)).
group
(
:commit_id
).
count
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
@@ -80,6 +77,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -80,6 +77,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
diffs
def
diffs
apply_diff_view_cookie!
apply_diff_view_cookie!
@merge_request_diff
=
@merge_request
.
merge_request_diff
@commit
=
@merge_request
.
diff_head_commit
@commit
=
@merge_request
.
diff_head_commit
@base_commit
=
@merge_request
.
diff_base_commit
||
@merge_request
.
likely_diff_base_commit
@base_commit
=
@merge_request
.
diff_base_commit
||
@merge_request
.
likely_diff_base_commit
...
@@ -109,7 +108,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -109,7 +108,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
commits
def
commits
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
format
.
html
{
render
'show'
}
format
.
json
{
render
json:
{
html:
view_to_html_string
(
'projects/merge_requests/show/_commits'
)
}
}
format
.
json
do
# Get commits from repository
# or from cache if already merged
@commits
=
@merge_request
.
commits
@note_counts
=
Note
.
where
(
commit_id:
@commits
.
map
(
&
:id
)).
group
(
:commit_id
).
count
render
json:
{
html:
view_to_html_string
(
'projects/merge_requests/show/_commits'
)
}
end
end
end
end
end
...
@@ -340,14 +347,33 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -340,14 +347,33 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
define_show_vars
def
define_show_vars
@noteable
=
@merge_request
@commits_count
=
@merge_request
.
commits
.
count
@pipeline
=
@merge_request
.
pipeline
@statuses
=
@pipeline
.
statuses
if
@pipeline
if
@merge_request
.
locked_long_ago?
@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
# Build a note object for comment form
# Build a note object for comment form
@note
=
@project
.
notes
.
new
(
noteable:
@
merge_request
)
@note
=
@project
.
notes
.
new
(
noteable:
@
noteable
)
@discussions
=
@
merge_request
.
mr_and_commit_notes
.
@discussions
=
@
noteable
.
mr_and_commit_notes
.
inc_author_project_award_emoji
.
inc_author_project_award_emoji
.
fresh
.
fresh
.
discussions
discussions
# This is not executed lazily
@notes
=
Banzai
::
NoteRenderer
.
render
(
@notes
=
Banzai
::
NoteRenderer
.
render
(
@discussions
.
flatten
,
@discussions
.
flatten
,
@project
,
@project
,
...
@@ -356,22 +382,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -356,22 +382,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@project_wiki
,
@project_wiki
,
@ref
@ref
)
)
@noteable
=
@merge_request
# Get commits from repository
# or from cache if already merged
@commits
=
@merge_request
.
commits
@merge_request_diff
=
@merge_request
.
merge_request_diff
@pipeline
=
@merge_request
.
pipeline
@statuses
=
@pipeline
.
statuses
if
@pipeline
if
@merge_request
.
locked_long_ago?
@merge_request
.
unlock_mr
@merge_request
.
close
end
end
end
def
define_widget_vars
def
define_widget_vars
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
8ab3ab9e
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
=
succeed
'.'
do
=
succeed
'.'
do
=
link_to
"command line"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
=
link_to
"command line"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
-
if
@commits
.
present
?
-
if
@commits
_count
.
nonzero
?
%ul
.merge-request-tabs.nav-links.no-top.no-bottom
%ul
.merge-request-tabs.nav-links.no-top.no-bottom
%li
.notes-tab
%li
.notes-tab
=
link_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#notes'
,
action:
'notes'
,
toggle:
'tab'
}
do
=
link_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#notes'
,
action:
'notes'
,
toggle:
'tab'
}
do
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
%li
.commits-tab
%li
.commits-tab
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
Commits
Commits
%span
.badge
=
@commits
.
size
%span
.badge
=
@commits
_count
-
if
@pipeline
-
if
@pipeline
%li
.builds-tab
%li
.builds-tab
=
link_to
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#builds'
,
action:
'builds'
,
toggle:
'tab'
}
do
=
link_to
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#builds'
,
action:
'builds'
,
toggle:
'tab'
}
do
...
...
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