diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-19 15:09:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-19 15:09:04 +0300 |
commit | c6af94ea4ea649171ff930b6bf94c73a5d03edb9 (patch) | |
tree | ceef77238b3a275a3a32b4e9f982b6d2f27e0c6b /app/services/todo_service.rb | |
parent | 3257ae3af07a4ad026be3c868e74ff82866fc400 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r-- | app/services/todo_service.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index 611d9daa2fe..e473a6dc594 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -47,7 +47,7 @@ class TodoService yield target - todo_users.each(&:update_todos_count_cache) + Users::UpdateTodoCountCacheService.new(todo_users).execute if todo_users.present? end # When we reassign an assignable object (issuable, alert) we should: @@ -227,14 +227,16 @@ class TodoService users_with_pending_todos = pending_todos(users, attributes).pluck_user_id users.reject! { |user| users_with_pending_todos.include?(user.id) && Feature.disabled?(:multiple_todos, user) } - users.map do |user| + todos = users.map do |user| issue_type = attributes.delete(:issue_type) track_todo_creation(user, issue_type) - todo = Todo.create(attributes.merge(user_id: user.id)) - user.update_todos_count_cache - todo + Todo.create(attributes.merge(user_id: user.id)) end + + Users::UpdateTodoCountCacheService.new(users).execute + + todos end def new_issuable(issuable, author) |