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
8c161d7b
Commit
8c161d7b
authored
Apr 07, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where commit comment would not show up in the right discussion on the MR page
parent
d80f9036
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
app/models/discussion.rb
app/models/discussion.rb
+9
-9
app/models/note.rb
app/models/note.rb
+2
-2
No files found.
app/models/discussion.rb
View file @
8c161d7b
...
...
@@ -4,7 +4,7 @@
class
Discussion
include
ResolvableDiscussion
attr_reader
:notes
,
:noteable
attr_reader
:notes
,
:
context_
noteable
delegate
:created_at
,
:project
,
...
...
@@ -16,12 +16,12 @@ class Discussion
to: :first_note
def
self
.
build
(
notes
,
noteable
=
nil
)
notes
.
first
.
discussion_class
(
noteable
).
new
(
notes
,
noteable
)
def
self
.
build
(
notes
,
context_
noteable
=
nil
)
notes
.
first
.
discussion_class
(
context_noteable
).
new
(
notes
,
context_
noteable
)
end
def
self
.
build_collection
(
notes
,
noteable
=
nil
)
notes
.
group_by
{
|
n
|
n
.
discussion_id
(
noteable
)
}.
values
.
map
{
|
notes
|
build
(
notes
,
noteable
)
}
def
self
.
build_collection
(
notes
,
context_
noteable
=
nil
)
notes
.
group_by
{
|
n
|
n
.
discussion_id
(
context_noteable
)
}.
values
.
map
{
|
notes
|
build
(
notes
,
context_
noteable
)
}
end
# Returns an alphanumeric discussion ID based on `build_discussion_id`
...
...
@@ -60,14 +60,14 @@ class Discussion
DiscussionNote
end
def
initialize
(
notes
,
noteable
=
nil
)
def
initialize
(
notes
,
context_
noteable
=
nil
)
@notes
=
notes
@
noteable
=
noteable
@
context_noteable
=
context_
noteable
end
def
==
(
other
)
other
.
class
==
self
.
class
&&
other
.
noteable
==
self
.
noteable
&&
other
.
context_noteable
==
self
.
context_
noteable
&&
other
.
id
==
self
.
id
&&
other
.
notes
==
self
.
notes
end
...
...
@@ -81,7 +81,7 @@ class Discussion
end
def
id
first_note
.
discussion_id
(
noteable
)
first_note
.
discussion_id
(
context_
noteable
)
end
alias_method
:to_param
,
:id
...
...
app/models/note.rb
View file @
8c161d7b
...
...
@@ -102,8 +102,8 @@ class Note < ActiveRecord::Base
ActiveModel
::
Name
.
new
(
self
,
nil
,
'note'
)
end
def
discussions
(
noteable
=
nil
)
Discussion
.
build_collection
(
fresh
,
noteable
)
def
discussions
(
context_
noteable
=
nil
)
Discussion
.
build_collection
(
fresh
,
context_
noteable
)
end
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