user_groups: Pass correct group object for adding new group to UI.

We previously passed the UserGroupRaw type object received in
the user group creation event to user_group_edit.add_group_to_table
instead of the UserGroup type object.

The add_group_to_table function is called after receiving creation
event only, but other functions called later in the flow are called
at other times as well like when opening edit panel for a particular
group and they expect UserGroup type object, so this commit fixes it.
This commit is contained in:
Sahil Batra
2024-09-09 15:11:46 +05:30
committed by Tim Abbott
parent f3fafc719f
commit 6482f0c2ea
3 changed files with 14 additions and 10 deletions

View File

@@ -39,7 +39,7 @@ export function init(): void {
// WE INITIALIZE DATA STRUCTURES HERE!
init();
export function add(user_group_raw: UserGroupRaw): void {
export function add(user_group_raw: UserGroupRaw): UserGroup {
// Reformat the user group members structure to be a set.
const user_group = {
description: user_group_raw.description,
@@ -56,6 +56,7 @@ export function add(user_group_raw: UserGroupRaw): void {
user_group_name_dict.set(user_group.name, user_group);
user_group_by_id_dict.set(user_group.id, user_group);
return user_group;
}
export function remove(user_group: UserGroup): void {