The main owner of an enterprise can remove themselves as a manager: after deleting their own email, an error 401 "unauthorized" is triggered but the owner is still removed, and loose access to the admin dashboard.
Expected Behavior
If it's allowed to remove oneself as manager, there shouldn't be an error.
If it's not allowed to remove oneself as manager, the trash icon shouldn't be activated.
Steps to Reproduce
Create an enterprise with a new account
In Enterprises> Users, add another mail in the fields: Managers, Notifications, and Owner
See that the trash to delete the initial account is activated
I think the correct behavior here must be to change the owner first. The downside is that currently only the owner can remove users. What do you think @openfoodfoundation/train-drivers-product-owners ?
Description
The main owner of an enterprise can remove themselves as a manager: after deleting their own email, an error 401 "unauthorized" is triggered but the owner is still removed, and loose access to the admin dashboard.
Expected Behavior
If it's allowed to remove oneself as manager, there shouldn't be an error. If it's not allowed to remove oneself as manager, the trash icon shouldn't be activated.
Steps to Reproduce
Animated Gif/Screenshot
Severity
bug-s3: a feature is broken but there is a workaround