Skip to content

Organizations - Support delayed group deletion

What does this MR do and why?

Closes #442810 (closed)
Built on top of API changes !148562 (merged)
Heavily inspired by !147479 (merged)
Implements this workflow: https://docs.gitlab.com/ee/user/group/#remove-a-group
Important: This change is behind a feature flag ui_for_organizations

This change adds UI support for Delayed Group Deletion in Organizations. This includes help text in the modal footer, proper deletion toasts, and the ability to fully delete a Group that is scheduled to be deleted.

Important: There is a known bug when permanently deleting Groups from this list: #455871

The potential flows are as follows:

CE Environments

a. In CE environments, delayed deletion is not possible. Thus there is no help text in the modal footer, groups are deleted immediately, and the toasts simply states the group is in the process of being deleted.

EE Environments

a. If delayed group deletion is disabled, it behaves the same as CE environment above.
b. If delayed group deletion is enabled, attempting to delete will show help text in the modal footer of when the group will be deleted, the group will then be marked as pending deletion, and the toast will re-affirm when the group will be fully deleted.
c. If delayed group deletion is enabled and the group is already scheduled to be deleted:

  • If it is a Top Level Group, deletion will be disabled and user is directed to the Settings page to finish deletion
  • If it is a Sub level group, deletion will follow the CE path of fully deleting the group

Screenshots or screen recordings

Demo

demo

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

  1. Create two test groups
    • The first group should be a top level group
    • The second group should be a subgroup to your top level group
  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 Groups in the dropdown

Top Level Group Deletion

  1. Click the ... for the top level group you made
  2. Ensure help text appears below the input box in the modal, stating when the group will be deleted and a learn more link
  3. Fill out input and click delete
  4. Ensure toast appears that says the group will be deleted on x date.
  5. Ensure group is still in the list with a pending deletion tag
  6. Click the ... again for the top level group you made
  7. Ensure modal says you cannot immediately delete from here and simply offers cancel button and directs to Group Settings page

Subgroup Deletion

  1. Click the ... for the subgroup you made
  2. Ensure help text appears below the input box in the modal, stating when the group will be deleted and a learn more link
  3. Fill out input and click delete
  4. Ensure toast appears that says the group will be deleted on x date.
  5. Ensure group is still in the list with a pending deletion tag
  6. Click the ... again for the top level group you made
  7. Ensure no help text appears, but description explains this group is scheduled for deletion already
  8. Fill out input and click delete
  9. Ensure toast appears that says the group is being deleted
  10. Important: There is a known bug here and there will be an Error alert at the top of the page: #455871
  11. Refresh page
  12. Ensure subgroup is now gone from list

Related to #442810 (closed)

Edited by Zack Cuddy

Merge request reports