user_group_pill: Accept setting_type as parameter in typeahead_source.

We currently use the pills UI only for can_manage_group setting so
it is fine to pass setting type as "group" directly to
get_realm_user_groups_for_setting, but it would be better to just
accept setting_type as parameter in typeahead_source and pass that
to get_realm_user_groups_for_setting as other settings will also
use the pills UI in future.
This commit is contained in:
Sahil Batra
2024-09-24 14:30:15 +05:30
committed by Tim Abbott
parent b2e1c5aec4
commit c4026615ae
7 changed files with 14 additions and 2 deletions

View File

@@ -1444,15 +1444,18 @@ type group_setting_name = "can_manage_group";
export function create_group_setting_widget({
$pill_container,
setting_name,
setting_type,
group,
}: {
$pill_container: JQuery;
setting_name: group_setting_name;
setting_type: "realm" | "stream" | "group";
group?: UserGroup;
}): void {
const pill_widget = group_setting_pill.create_pills($pill_container, setting_name);
const opts = {
setting_name,
setting_type,
group,
};
group_setting_pill.set_up_pill_typeahead({pill_widget, $pill_container, opts});