Skip to content

Organizations API - support delayed project deletion

Zack Cuddy requested to merge 442809_01-dealyed-deletion-api-changes into master

What does this MR do and why?

API Changes for !147479 (merged)
Part of #442809 (closed)
Important: This change is behind a feature flag ui_for_organizations

This change makes the necessary API changes to support the Frontend for delayed project deletion. The intention is to utilize the logic currently found in our RESTful Projects API

By itself this change doesn't do much besides expose new data to the GraphQL endpoint and update the mock project data.

CE Environments

Pending deletion is an EE only feature and thus will also return false/nil data for anything related to pending deletion.

EE Environments

  1. isAdjournedDeletionEnabled is only available on projects tied to groups. It is not enabled for personal projects
  2. permanent_deletion_date is the date, X days in the future, that is configured by the project for when the project will be deleted if it is triggered now.
  3. marked_for_deletion_on is the date when the deletion was triggered.

Screenshots or screen recordings

CE API Res EE API Res
CE EE

How to set up and validate locally

Setup Organizations

important: You only need to do this in your GDK if you haven't yet!

  1. Access rails c
  2. Enable Feature Flag Feature.enable(:ui_for_organizations)
  3. Create the default organization and add root to it
you = User.find_by_username('root')
default_organization = Organizations::Organization.default_organization
Organizations::OrganizationUser.create!(organization_id: default_organization.id, user_id: you.id)

Testing in EE

  1. Create two test projects

    • The first one should be a personal project on your user (ie. root)
    • The second one should be a project tied to a group (ie. Flight)
  2. Navigate to the GDK home page ex: 127.0.0.1:3000/

  3. Click Organizations in the sidebar

  4. Click the Default Organization

  5. Click the Manage > Groups and projects in the sidebar

  6. Switch list to Projects in the dropdown

  7. Check API response from GraphQL for your two projects

  8. Ensure isAdjournedDeletionEnabled is false and permanentDeletionDate is null for your personal project

  9. Ensure isAdjournedDeletionEnabled is true and permanentDeletionDate is a date one week out for your group project

  10. Click the ... for the project you made tied to a group

  11. Follow prompts to trigger deletion and then refresh the page

  12. Ensure your group project has label pending deletion

  13. Ensure the API response in GraphQL for your group project now has a value in markedForDeletionOn of today.

Edited by Zack Cuddy

Merge request reports