user groups: Remove redundant DOM operations on user group add event.

Settings DOM for newly created group were unnecessarily appended
in the right panel during live update. This was not needed as
these HTML elements are any way created for the window in which
the group was created and this was extra work for a window that
had groups overlay open but the group was not created in that window.

These changes also solved a minor bug where an extra delete button
appeared after the extra HTML elements were appended in the right
panel.
This commit is contained in:
m-e-l-u-h-a-n 2023-04-08 04:00:48 +05:30 committed by Tim Abbott
parent 4a8271e854
commit 350802a510
1 changed files with 0 additions and 9 deletions

View File

@ -1,7 +1,6 @@
import $ from "jquery";
import render_browse_user_groups_list_item from "../templates/user_group_settings/browse_user_groups_list_item.hbs";
import render_user_group_settings from "../templates/user_group_settings/user_group_settings.hbs";
import render_user_group_settings_overlay from "../templates/user_group_settings/user_group_settings_overlay.hbs";
import * as blueslip from "./blueslip";
@ -137,15 +136,7 @@ export function add_group_to_table(group) {
return;
}
const settings_html = render_user_group_settings({
group,
can_edit: user_group_edit.can_edit(group.id),
});
redraw_user_group_list();
scroll_util
.get_content_element($("#groups_overlay_container .settings"))
.append($(settings_html));
if (user_group_create.get_name() === group.name) {
// This `user_group_create.get_name()` check tells us whether the