BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b7c1b05f
Commit
b7c1b05f
authored
Aug 18, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No explicit `to_a` or instance variables needed.
parent
91be957c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
notes_actions.rb
app/controllers/concerns/notes_actions.rb
+7
-5
issues_controller.rb
app/controllers/projects/issues_controller.rb
+8
-4
No files found.
app/controllers/concerns/notes_actions.rb
View file @
b7c1b05f
...
...
@@ -13,15 +13,17 @@ module NotesActions
notes_json
=
{
notes:
[],
last_fetched_at:
current_fetched_at
}
@notes
=
notes_finder
.
execute
.
inc_relations_for_view
.
to_a
@notes
.
reject!
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
@notes
=
prepare_notes_for_rendering
(
@notes
)
notes
=
notes_finder
.
execute
.
inc_relations_for_view
.
reject
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
notes
=
prepare_notes_for_rendering
(
notes
)
notes_json
[
:notes
]
=
if
noteable
.
discussions_rendered_on_frontend?
note_serializer
.
represent
(
@
notes
)
note_serializer
.
represent
(
notes
)
else
@
notes
.
map
{
|
note
|
note_json
(
note
)
}
notes
.
map
{
|
note
|
note_json
(
note
)
}
end
render
json:
notes_json
...
...
app/controllers/projects/issues_controller.rb
View file @
b7c1b05f
...
...
@@ -97,13 +97,17 @@ class Projects::IssuesController < Projects::ApplicationController
end
def
discussions
notes
=
@issue
.
notes
.
inc_relations_for_view
.
includes
(
:noteable
).
fresh
.
to_a
notes
.
reject!
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
notes
=
@issue
.
notes
.
inc_relations_for_view
.
includes
(
:noteable
)
.
fresh
.
reject
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
prepare_notes_for_rendering
(
notes
)
@
discussions
=
Discussion
.
build_collection
(
notes
,
@issue
)
discussions
=
Discussion
.
build_collection
(
notes
,
@issue
)
render
json:
DiscussionSerializer
.
new
(
project:
@project
,
noteable:
@issue
,
current_user:
current_user
).
represent
(
@
discussions
)
render
json:
DiscussionSerializer
.
new
(
project:
@project
,
noteable:
@issue
,
current_user:
current_user
).
represent
(
discussions
)
end
def
create
...
...
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