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
Tatuya Kamada
gitlab-ce
Commits
077a1571
Commit
077a1571
authored
Apr 04, 2017
by
Douwe Maan
Committed by
Luke "Jared" Bennett
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add line breaks in long comments
parent
3ff708f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
app/models/discussion.rb
app/models/discussion.rb
+4
-2
app/models/out_of_context_discussion.rb
app/models/out_of_context_discussion.rb
+3
-2
No files found.
app/models/discussion.rb
View file @
077a1571
...
@@ -37,15 +37,17 @@ class Discussion
...
@@ -37,15 +37,17 @@ class Discussion
[
:discussion
,
note
.
noteable_type
.
try
(
:underscore
),
noteable_id
]
[
:discussion
,
note
.
noteable_type
.
try
(
:underscore
),
noteable_id
]
end
end
# To turn a list of notes into a list of discussions, they are grouped by discussion ID.
# When notes on a commit are displayed in context of a merge request that contains that commit,
# When notes on a commit are displayed in context of a merge request that contains that commit,
# these notes are to be displayed as if they were part of one discussion, even though they were actually
# these notes are to be displayed as if they were part of one discussion, even though they were actually
# individual notes on the commit with different discussion IDs, so that it's clear that these are not
# individual notes on the commit with different discussion IDs, so that it's clear that these are not
# notes on the merge request itself.
# notes on the merge request itself.
# To get these out-of-context notes to end up in the same discussion, we need to get them to return the same
#
# To turn a list of notes into a list of discussions, they are grouped by discussion ID, so to
# get these out-of-context notes to end up in the same discussion, we need to get them to return the same
# `discussion_id` when this grouping happens. To enable this, `Note#discussion_id` calls out
# `discussion_id` when this grouping happens. To enable this, `Note#discussion_id` calls out
# to the `override_discussion_id` method on the appropriate `Discussion` subclass, as determined by
# to the `override_discussion_id` method on the appropriate `Discussion` subclass, as determined by
# the `discussion_class` method on `Note` or a subclass of `Note`.
# the `discussion_class` method on `Note` or a subclass of `Note`.
#
# If no override is necessary, return `nil`.
# If no override is necessary, return `nil`.
# For the case described above, see `OutOfContextDiscussion.override_discussion_id`.
# For the case described above, see `OutOfContextDiscussion.override_discussion_id`.
def
self
.
override_discussion_id
(
note
)
def
self
.
override_discussion_id
(
note
)
...
...
app/models/out_of_context_discussion.rb
View file @
077a1571
# When notes on a commit are displayed in the context of a merge request that contains that commit,
# When notes on a commit are displayed in the context of a merge request that
# they are displayed as if they were a discussion.
# contains that commit, they are displayed as if they were a discussion.
#
# This represents one of those discussions, consisting of `Note` notes.
# This represents one of those discussions, consisting of `Note` notes.
class
OutOfContextDiscussion
<
Discussion
class
OutOfContextDiscussion
<
Discussion
# Returns an array of discussion ID components
# Returns an array of discussion ID components
...
...
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