diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-01 19:12:05 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-08 15:50:07 -0300 |
commit | d86c6666623a90d46fa4cfe624c67e86c6ad235f (patch) | |
tree | c3290abd871d37f2addb0794b6f526fc31e9d66c /app/services/todo_service.rb | |
parent | 796bdf1dcb86b5e77fc054208afc632f75518605 (diff) | |
download | gitlab-ce-d86c6666623a90d46fa4cfe624c67e86c6ad235f.tar.gz |
Refresh todos count cache when an Issue/MR is deleted
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r-- | app/services/todo_service.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index 2aab8c736d6..776530ac0a5 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -31,6 +31,14 @@ class TodoService mark_pending_todos_as_done(issue, current_user) end + # When we destroy an issue we should: + # + # * refresh the todos count cache for the current user + # + def destroy_issue(issue, current_user) + destroy_issuable(issue, current_user) + end + # When we reassign an issue we should: # # * create a pending todo for new assignee if issue is assigned @@ -64,6 +72,14 @@ class TodoService mark_pending_todos_as_done(merge_request, current_user) end + # When we destroy a merge request we should: + # + # * refresh the todos count cache for the current user + # + def destroy_merge_request(merge_request, current_user) + destroy_issuable(merge_request, current_user) + end + # When we reassign a merge request we should: # # * creates a pending todo for new assignee if merge request is assigned @@ -187,6 +203,10 @@ class TodoService create_mention_todos(issuable.project, issuable, author) end + def destroy_issuable(issuable, user) + user.update_todos_count_cache + end + def toggling_tasks?(issuable) issuable.previous_changes.include?('description') && issuable.tasks? && issuable.updated_tasks.any? |