summaryrefslogtreecommitdiff
path: root/app/services/todo_service.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-06-09 14:07:58 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-06-09 16:01:08 -0300
commitaff3c6999bfcbaea613e64c9bb95d42a3b5b3695 (patch)
tree6138d9bfca88dbbf46254a261f24543cec9a59ad /app/services/todo_service.rb
parentae126c5599315b817a22e9d7b7866ea532c4d880 (diff)
downloadgitlab-ce-aff3c6999bfcbaea613e64c9bb95d42a3b5b3695.tar.gz
Toggling a task in a description with mentions doesn't creates a Todo
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r--app/services/todo_service.rb11
1 files changed, 9 insertions, 2 deletions
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?