summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-25 19:04:16 +0000
committerRobert Speicher <robert@gitlab.com>2016-08-25 19:04:16 +0000
commit98eef887a4e80e1c1711d45f8507828f19dd3b0b (patch)
treeb834afc3db319dd534d38e4f018826e21e9fb189 /app/services
parent34a472f674fa0d26deea1b248b54a44354f889ba (diff)
parent7629dc9982f5559972acf9d9b9d98f78ad53e54c (diff)
downloadgitlab-ce-98eef887a4e80e1c1711d45f8507828f19dd3b0b.tar.gz
Merge branch '19730-mark-as-done' into 'master'
If the received id is still a pending todo mark it as done ## What does this MR do? Just return properly on stale todos, for me is annoying to mark as done a todo that is already done and the done hung there forever, so I have to refresh the page. I decided to resolve the issue myself. ## What are the relevant issue numbers? Closes #19730 See merge request !5795
Diffstat (limited to 'app/services')
-rw-r--r--app/services/todo_service.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index e0ccb654590..2aab8c736d6 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -148,7 +148,8 @@ class TodoService
def mark_todos_as_done_by_ids(ids, current_user)
todos = current_user.todos.where(id: ids)
- marked_todos = todos.update_all(state: :done)
+ # Only return those that are not really on that state
+ marked_todos = todos.where.not(state: :done).update_all(state: :done)
current_user.update_todos_count_cache
marked_todos
end