Fix mentioned users list on diff notes

parent 8b7932c2
...@@ -4,6 +4,9 @@ module NoteOnDiff ...@@ -4,6 +4,9 @@ module NoteOnDiff
NUMBER_OF_TRUNCATED_DIFF_LINES = 16 NUMBER_OF_TRUNCATED_DIFF_LINES = 16
included do included do
attr_mentionable :note, pipeline: :note
participant :author
delegate :blob, :highlighted_diff_lines, to: :diff_file, allow_nil: true delegate :blob, :highlighted_diff_lines, to: :diff_file, allow_nil: true
end end
......
...@@ -435,6 +435,24 @@ describe TodoService, services: true do ...@@ -435,6 +435,24 @@ describe TodoService, services: true do
should_create_todo(user: author, target: mr_unassigned, action: Todo::MARKED) should_create_todo(user: author, target: mr_unassigned, action: Todo::MARKED)
end end
end end
describe '#new_note' do
let(:mention) { john_doe.to_reference }
let(:diff_note_on_merge_request) { create(:diff_note_on_merge_request, project: project, noteable: mr_unassigned, author: author, note: "Hey #{mention}") }
let(:legacy_diff_note_on_merge_request) { create(:legacy_diff_note_on_merge_request, project: project, noteable: mr_unassigned, author: author, note: "Hey #{mention}") }
it 'creates a todo for mentioned user on new diff note' do
service.new_note(diff_note_on_merge_request, author)
should_create_todo(user: john_doe, target: mr_unassigned, author: author, action: Todo::MENTIONED, note: diff_note_on_merge_request)
end
it 'creates a todo for mentioned user on legacy diff note' do
service.new_note(legacy_diff_note_on_merge_request, author)
should_create_todo(user: john_doe, target: mr_unassigned, author: author, action: Todo::MENTIONED, note: legacy_diff_note_on_merge_request)
end
end
end end
it 'updates cached counts when a todo is created' do it 'updates cached counts when a todo is created' do
......
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