Commit 46f3e37d authored by Alfredo Sumaran's avatar Alfredo Sumaran Committed by Alfredo Sumaran

Customize Start discussion message according to if the noteable can be resolvable

parent 3871941d
# 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 }
......
......@@ -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.
......
- 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' : ''}."
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment