Todo count not updated correctly on project delete

Summary

When a project is deleted the todo count is not updated correctly

Steps to reproduce

  1. Clear all your todos
  2. Create a project
  3. Create an issue
  4. Assign the issue to yourself - note you now have a todo
  5. Delete the project - note you still have a todo count but no todos

Expected behavior

The todo count should be accurate of current todos

Actual behavior

Todo count shows as 1 or greater when no todos exist

Relevant logs and/or screenshots

image

Output of checks

Results of GitLab application Check

Passing

Results of GitLab environment info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.3.1p112
Gem Version:    2.6.6
Bundler Version:1.13.5
Rake Version:   10.5.0
Sidekiq Version:4.2.1

GitLab information
Version:        8.13.1
Revision:       91f25c2
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            https://x.com
HTTP Clone URL: https://x.com/some-group/some-project.git
SSH Clone URL:  git@x.com:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: saml

GitLab Shell
Version:        3.6.6
Repository storage paths:
- default:      /app/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:            /opt/gitlab/embedded/bin/git

Possible fixes

A cached value for todos_pending_count looks like it may be the problem.

Assignee Loading
Time tracking Loading