Add `include_hidden`, `include_pending_delete` option to Project API
What does this MR do and why?
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/430064
Problem
It's not possible to request projects in pending_delete
or hidden
state via Projects API.
Solution
Add two optional disabled by default parameters include_hidden
and
include_pending_delete
to Projects API.
They can be set only by the admin.
Screenshots or screen recordings
Before
After
How to set up and validate locally
To verify hidden state
- Open Rails console
- Temporary mark last project as hidden
Project.last.update(hidden: true)
- Go to project list (http://127.0.0.1:3000/api/v4/projects)
- The project should be missing in the list
- Visit page http://127.0.0.1:3000/api/v4/projects?include_hidden=true as an admin
- You should see a hidden project
- Visit page http://127.0.0.1:3000/api/v4/projects?include_hidden=true as a regular user
- You shouldn't see a hidden project
- Remove hidden state from the project
Project.last.update(hidden: false)
To verify pending delete state
- Open Rails console
- Temporary mark last project as pending delete
Project.last.update(pending_delete: true)
- Go to project list (http://127.0.0.1:3000/api/v4/projects)
- The project should be missing in the list
- Visit page http://127.0.0.1:3000/api/v4/projects?include_pending_delete=true as an admin
- You should see a pending delete project
- Visit page http://127.0.0.1:3000/api/v4/projects?include_pending_delete=true as a regular user
- You shouldn't see a pending delete project
- Remove pending delete state from the project
Project.last.update(pending_delete: false)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin