Fix mentioned users list on diff notes

This commit is contained in:
Douglas Barbosa Alexandre 2016-07-13 21:00:46 -03:00
parent 8b7932c219
commit 66c4ed6165
2 changed files with 21 additions and 0 deletions

View file

@ -4,6 +4,9 @@ module NoteOnDiff
NUMBER_OF_TRUNCATED_DIFF_LINES = 16
included do
attr_mentionable :note, pipeline: :note
participant :author
delegate :blob, :highlighted_diff_lines, to: :diff_file, allow_nil: true
end

View file

@ -435,6 +435,24 @@ describe TodoService, services: true do
should_create_todo(user: author, target: mr_unassigned, action: Todo::MARKED)
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
it 'updates cached counts when a todo is created' do