diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-31 06:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-31 06:09:00 +0300 |
commit | 89cd4b410196971a1259463e6d1121ba85d45a6f (patch) | |
tree | c49eece0b95cd465b2fbd46609027b3eeff02f80 /app/services/todo_service.rb | |
parent | 174560aed8a39694ebb6b7a2459d59dbc214c5a9 (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 | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index dea116c8546..611d9daa2fe 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -177,7 +177,7 @@ class TodoService def resolve_todos_for_target(target, current_user) attributes = attributes_for_target(target) - resolve_todos(pending_todos(current_user, attributes), current_user) + resolve_todos(pending_todos([current_user], attributes), current_user) end def resolve_todos(todos, current_user, resolution: :done, resolved_by_action: :system_done) @@ -220,9 +220,14 @@ class TodoService private def create_todos(users, attributes) - Array(users).map do |user| - next if pending_todos(user, attributes).exists? && Feature.disabled?(:multiple_todos, user) + users = Array(users) + return if users.empty? + + 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| issue_type = attributes.delete(:issue_type) track_todo_creation(user, issue_type) @@ -353,8 +358,8 @@ class TodoService end end - def pending_todos(user, criteria = {}) - PendingTodosFinder.new(user, criteria).execute + def pending_todos(users, criteria = {}) + PendingTodosFinder.new(users, criteria).execute end def track_todo_creation(user, issue_type) |