invite_stream_picker: Don't rely on custom code in input_pill.

By using a custom `generate_pill_html`, we can remove the
`has_stream` logic in `input_pill`, as part of a wider effort
to remove custom pill logic in `input_pill`.
This commit is contained in:
evykassirer 2024-07-29 17:06:20 -07:00 committed by Tim Abbott
parent 0d52ced27a
commit ccbc569bab
1 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,5 @@
import render_input_pill from "../templates/input_pill.hbs";
import * as input_pill from "./input_pill"; import * as input_pill from "./input_pill";
import {set_up_stream} from "./pill_typeahead"; import {set_up_stream} from "./pill_typeahead";
import * as stream_data from "./stream_data"; import * as stream_data from "./stream_data";
@ -49,6 +51,12 @@ export function create($stream_pill_container: JQuery): stream_pill.StreamPillWi
$container: $stream_pill_container, $container: $stream_pill_container,
create_item_from_text: create_item_from_stream_name, create_item_from_text: create_item_from_stream_name,
get_text_from_item: stream_pill.get_stream_name_from_item, get_text_from_item: stream_pill.get_stream_name_from_item,
generate_pill_html: (item) =>
render_input_pill({
...item,
has_stream: true,
display_value: stream_pill.get_display_string_from_item(item),
}),
}); });
add_default_stream_pills(pill_widget); add_default_stream_pills(pill_widget);
set_up_pill_typeahead({pill_widget, $pill_container: $stream_pill_container}); set_up_pill_typeahead({pill_widget, $pill_container: $stream_pill_container});