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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
78207b95
Commit
78207b95
authored
May 31, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move includes call to scope
parent
257f4eaa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
app/models/discussion.rb
app/models/discussion.rb
+1
-1
app/models/note.rb
app/models/note.rb
+1
-1
No files found.
app/models/discussion.rb
View file @
78207b95
...
@@ -21,7 +21,7 @@ class Discussion
...
@@ -21,7 +21,7 @@ class Discussion
end
end
def
self
.
build_collection
(
notes
,
context_noteable
=
nil
)
def
self
.
build_collection
(
notes
,
context_noteable
=
nil
)
grouped_notes
=
notes
.
includes
(
:noteable
).
group_by
{
|
n
|
n
.
discussion_id
(
context_noteable
)
}
grouped_notes
=
notes
.
group_by
{
|
n
|
n
.
discussion_id
(
context_noteable
)
}
grouped_notes
.
values
.
map
{
|
notes
|
build
(
notes
,
context_noteable
)
}
grouped_notes
.
values
.
map
{
|
notes
|
build
(
notes
,
context_noteable
)
}
end
end
...
...
app/models/note.rb
View file @
78207b95
...
@@ -110,7 +110,7 @@ class Note < ActiveRecord::Base
...
@@ -110,7 +110,7 @@ class Note < ActiveRecord::Base
end
end
def
discussions
(
context_noteable
=
nil
)
def
discussions
(
context_noteable
=
nil
)
Discussion
.
build_collection
(
fresh
,
context_noteable
)
Discussion
.
build_collection
(
all
.
includes
(
:noteable
).
fresh
,
context_noteable
)
end
end
def
find_discussion
(
discussion_id
)
def
find_discussion
(
discussion_id
)
...
...
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