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
Boxiang Sun
gitlab-ce
Commits
09338e39
Commit
09338e39
authored
Aug 17, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove cross-references user cannot see from issue discussions JSON
parent
99ba5d0d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+5
-3
app/models/concerns/noteable.rb
app/models/concerns/noteable.rb
+1
-1
No files found.
app/controllers/projects/issues_controller.rb
View file @
09338e39
...
...
@@ -97,9 +97,11 @@ class Projects::IssuesController < Projects::ApplicationController
end
def
discussions
@discussions
=
@issue
.
discussions
@discussions
.
reject!
{
|
d
|
d
.
individual_note?
&&
d
.
first_note
.
cross_reference_not_visible_for?
(
current_user
)
}
prepare_notes_for_rendering
(
@discussions
.
flat_map
(
&
:notes
))
notes
=
@issue
.
notes
.
inc_relations_for_view
.
includes
(
:noteable
).
fresh
.
to_a
notes
.
reject!
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
prepare_notes_for_rendering
(
notes
)
@discussions
=
Discussion
.
build_collection
(
notes
,
@issue
)
render
json:
DiscussionSerializer
.
new
(
project:
@project
,
noteable:
@issue
,
current_user:
current_user
).
represent
(
@discussions
)
end
...
...
app/models/concerns/noteable.rb
View file @
09338e39
...
...
@@ -38,7 +38,7 @@ module Noteable
def
grouped_diff_discussions
(
*
args
)
# Doesn't use `discussion_notes`, because this may include commit diff notes
# besides MR diff notes, that we do no want to display on the MR Changes tab.
# besides MR diff notes, that we do no
t
want to display on the MR Changes tab.
notes
.
inc_relations_for_view
.
grouped_diff_discussions
(
*
args
)
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