2018-07-25 09:30:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-06 15:05:57 +00:00
|
|
|
# A note in a non-diff discussion on an issue, merge request, commit, or snippet.
|
|
|
|
#
|
|
|
|
# A note of this type can be resolvable.
|
2017-03-10 01:29:11 +00:00
|
|
|
class DiscussionNote < Note
|
2019-09-13 13:26:31 +00:00
|
|
|
# This prepend must stay here because the `validates` below depends on it.
|
2021-05-11 21:10:21 +00:00
|
|
|
prepend_mod_with('DiscussionNote') # rubocop: disable Cop/InjectEnterpriseEditionModule
|
2019-09-13 13:26:31 +00:00
|
|
|
|
2017-04-06 15:05:57 +00:00
|
|
|
# Names of all implementers of `Noteable` that support discussions.
|
2018-10-26 13:23:58 +00:00
|
|
|
def self.noteable_types
|
|
|
|
%w(MergeRequest Issue Commit Snippet)
|
|
|
|
end
|
2017-03-10 01:29:11 +00:00
|
|
|
|
2018-10-26 13:23:58 +00:00
|
|
|
validates :noteable_type, inclusion: { in: noteable_types }
|
2017-03-10 01:29:11 +00:00
|
|
|
|
|
|
|
def discussion_class(*)
|
2017-04-04 22:27:23 +00:00
|
|
|
Discussion
|
2017-03-10 01:29:11 +00:00
|
|
|
end
|
|
|
|
end
|