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
Boxiang Sun
gitlab-ce
Commits
46f3e37d
Commit
46f3e37d
authored
Apr 05, 2017
by
Alfredo Sumaran
Committed by
Alfredo Sumaran
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Customize Start discussion message according to if the noteable can be resolvable
parent
3871941d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
app/models/discussion_note.rb
app/models/discussion_note.rb
+1
-0
app/models/note.rb
app/models/note.rb
+4
-0
app/views/projects/notes/_comment_type_button.html.haml
app/views/projects/notes/_comment_type_button.html.haml
+3
-2
No files found.
app/models/discussion_note.rb
View file @
46f3e37d
# A note in a non-diff discussion on an issue, merge request, commit, or snippet
class
DiscussionNote
<
Note
NOTEABLE_TYPES
=
%w(MergeRequest Issue Commit Snippet)
.
freeze
RESOLVABLE_TYPES
=
%w(MergeRequest)
.
freeze
validates
:noteable_type
,
inclusion:
{
in:
NOTEABLE_TYPES
}
...
...
app/models/note.rb
View file @
46f3e37d
...
...
@@ -228,6 +228,10 @@ class Note < ActiveRecord::Base
DiscussionNote
::
NOTEABLE_TYPES
.
include?
(
self
.
noteable_type
)
&&
!
part_of_discussion?
end
def
can_be_resolvable?
DiscussionNote
::
RESOLVABLE_TYPES
.
include?
(
self
.
noteable_type
)
end
def
discussion_class
(
noteable
=
nil
)
# When commit notes are rendered on an MR's Discussion page, they are
# displayed in one discussion instead of individually.
...
...
app/views/projects/notes/_comment_type_button.html.haml
View file @
46f3e37d
-
noteable_type
=
@note
.
noteable_type
.btn-group.append-right-10.comment-type-dropdown.js-comment-type-dropdown
%button
.btn.btn-nr.btn-create.comment-btn.js-comment-button.js-comment-submit-button
Comment
...
...
@@ -9,10 +10,10 @@
=
icon
(
'check'
)
.description
%strong
Comment
%p
=
"Add a general comment to this
#{
@note
.
noteable_type
.
titleize
.
downcase
}
."
%p
=
"Add a general comment to this
#{
noteable_type
.
titleize
.
downcase
}
."
%li
.divider
%li
#discussion
{
data:
{
value:
'DiscussionNote'
,
'button-text'
=>
'Start discussion'
,
'secondary-button-text'
=>
'Start discussion & close merge request'
}
}
=
icon
(
'check'
)
.description
%strong
Start discussion
%p
Discuss a specific suggestion or question that needs to be resolved.
%p
=
"Discuss a specific suggestion or question
#{
@note
.
can_be_resolvable?
?
' that needs to be resolved'
:
''
}
."
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