Does not create a todo when commenting on commit or project snippet
This commit is contained in:
parent
28097398c5
commit
c1482943c4
4 changed files with 15 additions and 3 deletions
|
@ -2,6 +2,9 @@ Please view this file on the master branch, on stable branches it's out of date.
|
|||
|
||||
v 8.6.0 (unreleased)
|
||||
|
||||
v 8.5.2
|
||||
- Fix error 500 when commenting on a commit
|
||||
|
||||
v 8.5.0
|
||||
- Fix duplicate "me" in tooltip of the "thumbsup" awards Emoji (Stan Hu)
|
||||
- Cache various Repository methods to improve performance (Yorick Peterse)
|
||||
|
|
|
@ -13,6 +13,5 @@ module Notes
|
|||
|
||||
note
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,8 +130,8 @@ class TodoService
|
|||
end
|
||||
|
||||
def handle_note(note, author)
|
||||
# Skip system notes, like status changes and cross-references
|
||||
return if note.system
|
||||
# Skip system notes, notes on commit, and notes on project snippet
|
||||
return if note.system? || ['Commit', 'Snippet'].include?(note.noteable_type)
|
||||
|
||||
project = note.project
|
||||
target = note.noteable
|
||||
|
|
|
@ -110,6 +110,8 @@ describe TodoService, services: true do
|
|||
let!(:first_todo) { create(:todo, :assigned, user: john_doe, project: project, target: issue, author: author) }
|
||||
let!(:second_todo) { create(:todo, :assigned, user: john_doe, project: project, target: issue, author: author) }
|
||||
let(:note) { create(:note, project: project, noteable: issue, author: john_doe, note: mentions) }
|
||||
let(:note_on_commit) { create(:note_on_commit, project: project, author: john_doe, note: mentions) }
|
||||
let(:note_on_project_snippet) { create(:note_on_project_snippet, project: project, author: john_doe, note: mentions) }
|
||||
let(:award_note) { create(:note, :award, project: project, noteable: issue, author: john_doe, note: 'thumbsup') }
|
||||
let(:system_note) { create(:system_note, project: project, noteable: issue) }
|
||||
|
||||
|
@ -145,6 +147,14 @@ describe TodoService, services: true do
|
|||
should_not_create_todo(user: john_doe, target: issue, author: john_doe, action: Todo::MENTIONED, note: note)
|
||||
should_not_create_todo(user: stranger, target: issue, author: john_doe, action: Todo::MENTIONED, note: note)
|
||||
end
|
||||
|
||||
it 'does not create todo when leaving a note on commit' do
|
||||
should_not_create_any_todo { service.new_note(note_on_commit, john_doe) }
|
||||
end
|
||||
|
||||
it 'does not create todo when leaving a note on snippet' do
|
||||
should_not_create_any_todo { service.new_note(note_on_project_snippet, john_doe) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue