2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-06 11:05:57 -04: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-09 20:29:11 -05:00
|
|
|
class DiscussionNote < Note
|
2019-09-13 09:26:31 -04:00
|
|
|
# This prepend must stay here because the `validates` below depends on it.
|
2021-05-11 17:10:21 -04:00
|
|
|
prepend_mod_with('DiscussionNote') # rubocop: disable Cop/InjectEnterpriseEditionModule
|
2019-09-13 09:26:31 -04:00
|
|
|
|
2017-04-06 11:05:57 -04:00
|
|
|
# Names of all implementers of `Noteable` that support discussions.
|
2018-10-26 09:23:58 -04:00
|
|
|
def self.noteable_types
|
|
|
|
%w(MergeRequest Issue Commit Snippet)
|
|
|
|
end
|
2017-03-09 20:29:11 -05:00
|
|
|
|
2018-10-26 09:23:58 -04:00
|
|
|
validates :noteable_type, inclusion: { in: noteable_types }
|
2017-03-09 20:29:11 -05:00
|
|
|
|
|
|
|
def discussion_class(*)
|
2017-04-04 18:27:23 -04:00
|
|
|
Discussion
|
2017-03-09 20:29:11 -05:00
|
|
|
end
|
|
|
|
end
|