user_groups: Don't allow adding deactivated groups as subgroups in UI.

We already have the code to ignore the deactivated groups before
sending the request and show appropriate message. This commit
just adds code to not show them in the typeahead and also not
create its pill if user types the full group name.
This commit is contained in:
Sahil Batra 2024-10-25 19:00:00 +05:30 committed by Tim Abbott
parent 69c0a772cc
commit caf919fca2
1 changed files with 4 additions and 0 deletions

View File

@ -318,6 +318,10 @@ export function check_group_can_be_subgroup(
// This logic could be optimized if we maintained a reverse map
// from each group to the groups containing it, which might be a
// useful data structure for other code paths as well.
if (subgroup.deactivated) {
return false;
}
const already_subgroup_ids = target_user_group.direct_subgroup_ids;
if (subgroup.id === target_user_group.id) {
return false;