From 2700ad7903c229cdcf03641e48078df2ae732872 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Mon, 17 Apr 2023 15:02:39 +0530 Subject: [PATCH] typeahead: Show stream privacy icons in typeahead options. We now show the stream privacy icons along with their names in the typeahead options. --- web/src/typeahead_helper.js | 2 +- web/templates/typeahead_list_item.hbs | 6 +++++- web/tests/typeahead_helper.test.js | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/src/typeahead_helper.js b/web/src/typeahead_helper.js index 080949afb0..9325b7d3d2 100644 --- a/web/src/typeahead_helper.js +++ b/web/src/typeahead_helper.js @@ -123,8 +123,8 @@ export function render_stream(stream) { } return render_typeahead_item({ - primary: stream.name, secondary: desc, + stream, is_unsubscribed: !stream.subscribed, }); } diff --git a/web/templates/typeahead_list_item.hbs b/web/templates/typeahead_list_item.hbs index 3b6b832194..49fb2f21c2 100644 --- a/web/templates/typeahead_list_item.hbs +++ b/web/templates/typeahead_list_item.hbs @@ -18,7 +18,11 @@ {{/if}} - {{~ primary ~}} + {{~#if stream}} + {{> inline_decorated_stream_name stream=stream }} + {{else}} + {{~ primary ~}} + {{/if}} {{~#if has_status}} {{> status_emoji status_emoji_info}} diff --git a/web/tests/typeahead_helper.test.js b/web/tests/typeahead_helper.test.js index 700d4c1768..fa4d02aeb7 100644 --- a/web/tests/typeahead_helper.test.js +++ b/web/tests/typeahead_helper.test.js @@ -722,7 +722,7 @@ test("render_stream", ({mock_template}) => { }; mock_template("typeahead_list_item.hbs", false, (args) => { - assert.equal(args.primary, stream.name); + assert.equal(args.stream, stream); assert.equal(args.secondary, stream.description); rendered = true; return "typeahead-item-stub"; @@ -741,7 +741,7 @@ test("render_stream w/long description", ({mock_template}) => { }; mock_template("typeahead_list_item.hbs", false, (args) => { - assert.equal(args.primary, stream.name); + assert.equal(args.stream, stream); const short_desc = stream.description.slice(0, 35); assert.equal(args.secondary, short_desc + "..."); rendered = true;