Allow admins to list and restore projects pending delayed deletion
Summary
This MR is a continuation of the original Community Contribution MR.
Most code is same as the original MR, except for few changes including moving code inside EE, spec addition and refinement.
What does this MR do?
This MR adds an ability for Admins to view Projects that are scheduled to be deleted (delayed deletion) in the Project Overview Dashboard.
The admins also have an option to restore any of the Projects scheduled to be deleted.
The Projects are listed until they are permanently deleted.
Since delayed deletion feature is available only for Premium or Silver or higher tiers, we display the list only if the license feature adjourned_deletion_for_projects_and_groups
is available.
Mentions #24866 (closed)
Screenshots
Database Queries
Query:
SELECT
"projects".*
FROM
"projects"
WHERE (EXISTS (
SELECT
1
FROM
"project_authorizations"
WHERE
"project_authorizations"."user_id" = 506061
AND (project_authorizations.project_id = projects.id))
OR projects.visibility_level IN (0, 10, 20))
AND (marked_for_deletion_at <= '2020-07-21')
AND "projects"."pending_delete" = FALSE
ORDER BY
"projects"."id" DESC
Plan:
https://explain.depesz.com/s/cOCU
Execution Time:
Time: 5.915 ms
- planning: 0.950 ms
- execution: 4.965 ms
- I/O read: 0.181 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 1932 (~15.10 MiB) from the buffer pool
- reads: 3 (~24.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
#database-lab link: https://gitlab.slack.com/archives/CLJMDRD8C/p1595373968049600
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team