Group transfer: Enter invalid namespace or nothing followed by `enter` does not ask for confirmation or throw error
Summary
When entering an invalid namespace or nothing in the namespace search field when transferring a group, followed by hitting Enter
, the group gets moved to a net-new top-level namespace without a confirmation dialogue. This dialogue does appear when a valid namespace is selected from the dropdown.
It also doesn't throw an error, which I would expect when entering no namespace or an invalid one followed by Enter
.
Steps to reproduce
- On GitLab.com, create a parent group, followed by a subgroup (make sure the subgroup namespace is not used yet on the root level).
- Access the subgroup ->
Settings
->General
->Advanced
->Transfer group
- In
Select parent group
, type a random stringfsddsfjljsflj
, followed byEnter
- The group gets moved to the top-level namespace, with a blue banner appearing
Group 'mySubGroup' was successfully transferred.
Example Project
https://gitlab.com/group_created_by_transfer_1234 was created that way.
What is the current bug behavior?
See above. There should be an error or at least a confirmation message that warns the user about the group being moved to the top-level namespace. If the user had selected a valid group in the dropdown, they would have at least received a confirmation message before executing the change. However, when entering an invalid group, followed by hitting Enter
, the user doesn't have to confirm the changes, and neither do they get an error message.
This, in combination with this known behavior described in our documentation:
Only explicit group membership is transferred, not inherited membership. If the group’s owners have only inherited membership, this leaves the group without an owner. In this case, the user transferring the group becomes the group’s owner.
Can lead to the transferring user being completely locked out of the new group without a clear warning beforehand.
What is the expected correct behavior?
Either throw an error when entering an invalid namespace followed by hitting Enter
, or display a pop-up to the customer, warning that they will transfer their group to the root namespace, asking them to confirm the changes.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Proposal
-
Ensure that when entering a valid namespace and hitting Enter
, the confirmation dialogue appears that needs to be confirmed before starting the transfer -
Ensure that when entering an invalid namespace and hittingEnter
, an error message is thrown (just like for projects) and the transfer is not initiated:Please select a new namespace for your group.
. The group should stay where it is. -
Ensure that when entering no namespace (leaving the field empty) and hitting Enter
, an adapted confirmation message is shown:You are about to transfer [group name] to a top-level namespace. This action changes the group's path and can lead to data loss.
(Currently the message says...changes the project's path...
, which is incorrect, since this is about group transfer).
Implementation guide
Change app/assets/javascripts/groups_projects/components/transfer_locations.vue to use GlCollapsibleListbox
. The search input in this component has @keydown.enter.prevent
set on it so it won't submit the form when pressing the enter key.