From aff3c6999bfcbaea613e64c9bb95d42a3b5b3695 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Thu, 9 Jun 2016 14:07:58 -0300 Subject: Toggling a task in a description with mentions doesn't creates a Todo --- app/services/todo_service.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/services/todo_service.rb') diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index d8365124175..8e03ff8ddde 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -20,7 +20,7 @@ class TodoService # * mark all pending todos related to the issue for the current user as done # def update_issue(issue, current_user) - create_mention_todos(issue.project, issue, current_user) + update_issuable(issue, current_user) end # When close an issue we should: @@ -53,7 +53,7 @@ class TodoService # * create a todo for each mentioned user on merge request # def update_merge_request(merge_request, current_user) - create_mention_todos(merge_request.project, merge_request, current_user) + update_issuable(merge_request, current_user) end # When close a merge request we should: @@ -153,6 +153,13 @@ class TodoService create_mention_todos(issuable.project, issuable, author) end + def update_issuable(issuable, author) + # Skip toggling a task list item in a description + return if issuable.tasks? && issuable.updated_tasks.any? + + create_mention_todos(issuable.project, issuable, author) + end + def handle_note(note, author) # Skip system notes, and notes on project snippet return if note.system? || note.for_snippet? -- cgit v1.2.1