Skip to content

Bugfix "API Support for Immediate Group Deletion"

What does this MR do and why?

In the MR !92508 (merged), an additional param permanently_remove was introduced in delete groups api for allowing subgroups of premium groups to get deleted immediately.

The following minor bugs were detected post that release as discussed in #360008 (comment 1049841122):

  • If you send a request with the new params to a group (including top-level groups) that is not yet pending deletion, you’ll still receive a 202 Accepted response, but the group is actually being marked as pending for deletion. This is a bit confusing, since it would seem the group was deleted permanently based on the response and the given parameters.
  • "Invalid" requests will still mark the group as pending deletion (ex: sending a request like http://127.0.0.1:3000/api/v4/groups/2253?permanently_remove=true without full_path, or http://127.0.0.1:3000/api/v4/groups/2253?permanently_remove=true&full_path=invalid-path, where full_path is not the group’s full path ). When you send the request again, it will return 400 bad request with "Group has been already marked for deletion”. This can be confusing to users as well.

This MR is going to handle those edge cases and return appropriate error message to user and disallow silent operation of marking a group for deletion.

Screenshots or screen recordings

NA

How to set up and validate locally

  1. Create a premium top-level group, say group_A().
  2. Create subgroup with name subgroup_1 of group_A.
  3. Call delete group API for subgroup_1 with params permanently_remove with value true and full_path with correct value, it should throw an error with message "Group must be marked for deletion first.".
  4. Call delete group API for subgroup_1, the group will get marked for deletion in a specific no. of days as governed in instance setting.
  5. Again call delete group API for subgroup_1, with params permanently_remove with value true and following cases:
    1. full_path with incorrect value, the API should respond with error message "full_path has wrong value.".
    2. full_path with correct value. The subgroup_1 should get deleted immediately.
  6. Call delete group API for group_A, it will get marked for deletion in few days.
  7. Call delete group API again for group_A with params permanently_remove with value true and full_path with correct value, API should return error "permanently_remove option is only available for subgroups."

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #360008 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports

Loading