Project's API is listing projects pending delete

Summary

We use this endpoint: /api/v4/projects.json?simple=true&search=&per_page=20&membership=true&order_by=last_activity_at&with_issues_enabled=true to display a list of projects in a few places in our interface (like the dropdown on the title of the repository name (when viewing any project related page) or when clicking at the "New issues" in the issues dashboard:

Projects_in_Issues_Dashboard

Projects_in_navigation_dropdown

In both situations we don't filter to exclude projects pending_delete = true. So even if the project is already "soft deleted" it still shows up in the lists, and clicking on it brings the user to a 404 page.

Steps to reproduce

In a machine you can control turn off sidekiq workers, remove a project from the interface (it will be marked as pending_delete). Go to another project's page and try to click on the navigation dropdown, or go to issues dashboard and try clicking in "New issue" dropdown. You should still be able to see / search the project there.

What is the current bug behavior?

It doesn't filter out projects pending_delete from the API request

What is the expected correct behavior?

Projects marked as pending delete should be filter out from the listing

Possible fixes

Always use without_deleted scope for the listing API, or default to it if it's possible to search both.

Assignee Loading
Time tracking Loading