From ccbc569bab3327ef7185463ffca92f3bcb9c32cd Mon Sep 17 00:00:00 2001 From: evykassirer Date: Mon, 29 Jul 2024 17:06:20 -0700 Subject: [PATCH] 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`. --- web/src/invite_stream_picker_pill.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/src/invite_stream_picker_pill.ts b/web/src/invite_stream_picker_pill.ts index 39277c61c9..b85761e90a 100644 --- a/web/src/invite_stream_picker_pill.ts +++ b/web/src/invite_stream_picker_pill.ts @@ -1,3 +1,5 @@ +import render_input_pill from "../templates/input_pill.hbs"; + import * as input_pill from "./input_pill"; import {set_up_stream} from "./pill_typeahead"; 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, create_item_from_text: create_item_from_stream_name, 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); set_up_pill_typeahead({pill_widget, $pill_container: $stream_pill_container});