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
Hide 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 @@
...
@@ -4,7 +4,7 @@
class
Discussion
class
Discussion
include
ResolvableDiscussion
include
ResolvableDiscussion
attr_reader
:notes
,
:noteable
attr_reader
:notes
,
:
context_
noteable
delegate
:created_at
,
delegate
:created_at
,
:project
,
:project
,
...
@@ -16,12 +16,12 @@ class Discussion
...
@@ -16,12 +16,12 @@ class Discussion
to: :first_note
to: :first_note
def
self
.
build
(
notes
,
noteable
=
nil
)
def
self
.
build
(
notes
,
context_
noteable
=
nil
)
notes
.
first
.
discussion_class
(
noteable
).
new
(
notes
,
noteable
)
notes
.
first
.
discussion_class
(
context_noteable
).
new
(
notes
,
context_
noteable
)
end
end
def
self
.
build_collection
(
notes
,
noteable
=
nil
)
def
self
.
build_collection
(
notes
,
context_
noteable
=
nil
)
notes
.
group_by
{
|
n
|
n
.
discussion_id
(
noteable
)
}.
values
.
map
{
|
notes
|
build
(
notes
,
noteable
)
}
notes
.
group_by
{
|
n
|
n
.
discussion_id
(
context_noteable
)
}.
values
.
map
{
|
notes
|
build
(
notes
,
context_
noteable
)
}
end
end
# Returns an alphanumeric discussion ID based on `build_discussion_id`
# Returns an alphanumeric discussion ID based on `build_discussion_id`
...
@@ -60,14 +60,14 @@ class Discussion
...
@@ -60,14 +60,14 @@ class Discussion
DiscussionNote
DiscussionNote
end
end
def
initialize
(
notes
,
noteable
=
nil
)
def
initialize
(
notes
,
context_
noteable
=
nil
)
@notes
=
notes
@notes
=
notes
@
noteable
=
noteable
@
context_noteable
=
context_
noteable
end
end
def
==
(
other
)
def
==
(
other
)
other
.
class
==
self
.
class
&&
other
.
class
==
self
.
class
&&
other
.
noteable
==
self
.
noteable
&&
other
.
context_noteable
==
self
.
context_
noteable
&&
other
.
id
==
self
.
id
&&
other
.
id
==
self
.
id
&&
other
.
notes
==
self
.
notes
other
.
notes
==
self
.
notes
end
end
...
@@ -81,7 +81,7 @@ class Discussion
...
@@ -81,7 +81,7 @@ class Discussion
end
end
def
id
def
id
first_note
.
discussion_id
(
noteable
)
first_note
.
discussion_id
(
context_
noteable
)
end
end
alias_method
:to_param
,
:id
alias_method
:to_param
,
:id
...
...
app/models/note.rb
View file @
8c161d7b
...
@@ -102,8 +102,8 @@ class Note < ActiveRecord::Base
...
@@ -102,8 +102,8 @@ class Note < ActiveRecord::Base
ActiveModel
::
Name
.
new
(
self
,
nil
,
'note'
)
ActiveModel
::
Name
.
new
(
self
,
nil
,
'note'
)
end
end
def
discussions
(
noteable
=
nil
)
def
discussions
(
context_
noteable
=
nil
)
Discussion
.
build_collection
(
fresh
,
noteable
)
Discussion
.
build_collection
(
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