Skip to content

Remove search for anything related to a deleted project

Carryover proposal item (3) from the MVC released in #24866 (closed)

Problem to solve

Projects can be placed in a "pending deletion" state. Currently, projects that are pending deletion are still displayed in some places, which is not desirable behavior.

Proposal

Projects pending deletion should be excluded/hidden everywhere except the Deleted Projects page:

  • Homepage
    • Your projects (Paginated list)
    • Starred projects (Paginated list)
    • Explore projects (Paginated list)
    • Explore topics
    • "Filter by name" feature
  • Group homepage
    • Paginated list
    • "Search by name" feature
    • Archived projects tab (https://gitlab.com/groups/<group_name>/-/archived)
  • "Move issue" feature
  • User Homepage
    • Starred projects (https://gitlab.com/users/<username>/starred)
    • Contributed projects (https://gitlab.com/users/<username>/contributed)
    • Overview tab
    • Activity tab (https://gitlab.com/users/<username>/activity)
  • Visiting the deleted project's URL itself. It shows a warning "Deletion pending. This project will be deleted on . Repository and other project resources are read-only."
  • Projects marked for deletion are accessible via APIs

Implementation Plan

  1. On the homepage by default don't display the projects that are pending deletion and it's handled via without_deleted: true param which in turn uses the scope where(pending_delete: false) and therefore doesn't list those projects which are pending deletion. it's handled via the set_non_archived_param filter
  2. We know that once a project is marked for deletion we also set the field archived as true for that project and therefore it is not visible at a lot of places like "Move issue" feature, group issue list etc. For these the current logic will still work and we don't need to modify the queries as there is no way for the user to include the archived projects here unlike the homepage where they can view the archived projects as well if selected.
  3. The pending deletion projects are still be accessible on the homepage if we choose to display the archived projects from the top right menu and therefore to remove them completely we'll have to remove them from the query itself.
  4. As part of the implementation we need to do the following:
    1. We need to create an index for the scope :not_aimed_for_deletion, -> { where(marked_for_deletion_at: nil) }
    2. Use the above scope in the users_controller and the dashboard/projects_controller so that we don't return the projects that are marked for deletion.
Edited by Huzaifa Iftikhar