Skip to content

Add message to modal explaining that the last owner can't be removed

Peter Hegman requested to merge 24047-unable-to-remove-owner-3 into master

What does this MR do and why?

Related to #24047 (closed)

The last owner of a group or project cannot be removed because then nobody would have privileges to manage the group or project. Currently Remove member or Leave actions are not shown (or in the case of personal projects they are but cause a 403 which is a bug) but there is nothing explaining why. This MR shows the Remove member or Leave actions for last owners and adds copy to the modal explaining why they can't continue with the action. In the future we may add a way to add a new owner at the same time you remove the old one. See #24047 (comment 1164315167) for the concept.

Screenshots or screen recordings

Trying to remove yourself from a group

Before After
Screenshot_2023-01-05_at_5.45.20_PM Screenshot_2023-01-05_at_5.30.35_PM
No modal Screenshot_2023-01-05_at_5.30.48_PM

An admin trying to remove the last owner from a group

Before After
Screenshot_2023-01-05_at_5.43.43_PM Screenshot_2023-01-05_at_5.32.02_PM
No modal Screenshot_2023-01-05_at_5.32.15_PM

Trying to remove yourself from a personal project

Before After
Screenshot_2023-01-05_at_5.42.47_PM Screenshot_2023-01-05_at_5.36.39_PM
403 after confirming in modal Screenshot_2023-01-05_at_5.42.21_PM Screenshot_2023-01-05_at_5.36.52_PM

An admin trying to remove the last owner from a personal project

Before After
Screenshot_2023-01-05_at_5.42.07_PM Screenshot_2023-01-05_at_5.37.13_PM
403 after confirming in modal Screenshot_2023-01-05_at_5.42.21_PM Screenshot_2023-01-05_at_5.37.25_PM

How to set up and validate locally

Trying to remove yourself from a group

  1. Navigate to a group you are an Owner of
  2. Change all the roles so you are the only Owner

An admin trying to remove the last owner from a group

  1. Sign in as an Admin
  2. Navigate to a group you are not a member of
  3. Change roles so there is only one Owner
  4. Try to remove that Owner

Trying to remove yourself from a personal project

  1. Create a personal project
  2. Try to Leave that personal project

An admin trying to remove the last owner from a personal project

  1. Sign in as an Admin
  2. Navigate to a personal project that is not yours
  3. Try to remove the creator of the personal project

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 Peter Hegman

Merge request reports

Loading