Skip to content

Exclude trial groups from delete checks

sameer shaik requested to merge gl-extrial into master

What does this MR do and why?

As of now, it's not possible to trigger the delete action in GitLab.com groups with a trial plan and the UI shows the following message.

This group can't be removed because it is linked to a subscription. To remove this group, link the subscription with a different group.

Users cannot link the trial plan with a different group and, the users reach out to the support team to unlink the trial plan so they can delete their groups. This MR intends to address customers-gitlab-com#3470 (closed).

This MR enables the Delete group button for a group on a trial plan.

One of the proposed solutions in the issue is to remove the trial plans(ULTIMATE_TRIAL, PREMIUM_TRIAL) at plan.rb#L20 - this bypasses the validation and the namespace.paid? method returns false for all the groups with trial plans. However, all the trial plans has the same features as paid plans(except group/project access tokens) and multiple methods in other parts of the codebase depends on the .paid? method.

Removing the trial plans from the paid? group might have unintended effects.

Alternatively, we can modify the groups controller to add one more condition to the check_subscription callback.

module EE
  module GroupsController

      before_action :check_subscription!, only: [:destroy]
    def check_subscription!
      if group.paid? #on top of this the group shouldn't be on a trial plan i.e trial should be false !group.trial?
        redirect_to edit_group_path(group),
          status: :found,
          alert: _('This group is linked to a subscription')
      end
    end

Screenshots or screen recordings

Before: Screenshot_2022-10-21_at_7.30.09_PM

After: Screenshot_2022-10-21_at_7.33.15_PM

How to set up and validate locally

  1. Checkout the feature branch
  2. Enable simulate saas flag
  3. Navigate to Settings -> General and expand Account and limit group
  4. Enable the Allow use of licensed EE features feature under Check feature availability on namespace plan section
  5. Create a group with a trial plan and notice that the Delete group button is enabled in group settings

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Edited by sameer shaik

Merge request reports