Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 986a85acac6..1715f7cdc3b 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -23,6 +23,8 @@ class Note < ApplicationRecord
include FromUnion
include Sortable
+ ISSUE_TASK_SYSTEM_NOTE_PATTERN = /\A.*marked\sthe\stask.+as\s(completed|incomplete).*\z/.freeze
+
cache_markdown_field :note, pipeline: :note, issuable_reference_expansion_enabled: true
redact_field :note
@@ -685,6 +687,22 @@ class Note < ApplicationRecord
Ability.users_that_can_read_internal_notes(users, resource_parent).pluck(:id)
end
+ # Method necesary while we transition into the new format for task system notes
+ # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/369923
+ def note
+ return super unless system? && for_issue? && super.match?(ISSUE_TASK_SYSTEM_NOTE_PATTERN)
+
+ super.sub!('task', 'checklist item')
+ end
+
+ # Method necesary while we transition into the new format for task system notes
+ # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/369923
+ def note_html
+ return super unless system? && for_issue? && super.match?(ISSUE_TASK_SYSTEM_NOTE_PATTERN)
+
+ super.sub!('task', 'checklist item')
+ end
+
private
def system_note_viewable_by?(user)