diff options
author | Robert Speicher <robert@gitlab.com> | 2016-06-09 22:47:15 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-06-09 22:47:15 +0300 |
commit | a458211b6569b510593393220a6c1f5b4e25cfb8 (patch) | |
tree | c02730e46e6cd810d224948fdb676bff35024134 /app | |
parent | d64517c37d1e14dfe8f27eadfb40dcb034a57092 (diff) | |
parent | 0098468dfb5927b4034d38c7faac44ac238b9385 (diff) |
Merge branch 'toggling-task-should-not-generate-todo' into 'master'
Toggling a task in a description with mentions doesn't creates a Todo
When user toggle a task list item in a description with a mention it
does not create an unnecessary Todo for that mention.
Closes #14116
See merge request !4568
Diffstat (limited to 'app')
-rw-r--r-- | app/services/todo_service.rb | 11 |
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? |