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
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+7
-5
app/controllers/projects/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
...
@@ -13,15 +13,17 @@ module NotesActions
notes_json
=
{
notes:
[],
last_fetched_at:
current_fetched_at
}
notes_json
=
{
notes:
[],
last_fetched_at:
current_fetched_at
}
@notes
=
notes_finder
.
execute
.
inc_relations_for_view
.
to_a
notes
=
notes_finder
.
execute
@notes
.
reject!
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
.
inc_relations_for_view
@notes
=
prepare_notes_for_rendering
(
@notes
)
.
reject
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
notes
=
prepare_notes_for_rendering
(
notes
)
notes_json
[
:notes
]
=
notes_json
[
:notes
]
=
if
noteable
.
discussions_rendered_on_frontend?
if
noteable
.
discussions_rendered_on_frontend?
note_serializer
.
represent
(
@
notes
)
note_serializer
.
represent
(
notes
)
else
else
@
notes
.
map
{
|
note
|
note_json
(
note
)
}
notes
.
map
{
|
note
|
note_json
(
note
)
}
end
end
render
json:
notes_json
render
json:
notes_json
...
...
app/controllers/projects/issues_controller.rb
View file @
b7c1b05f
...
@@ -97,13 +97,17 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -97,13 +97,17 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
def
discussions
def
discussions
notes
=
@issue
.
notes
.
inc_relations_for_view
.
includes
(
:noteable
).
fresh
.
to_a
notes
=
@issue
.
notes
notes
.
reject!
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
.
inc_relations_for_view
.
includes
(
:noteable
)
.
fresh
.
reject
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
prepare_notes_for_rendering
(
notes
)
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
end
def
create
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