Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

search_pill: Use decorated channel icon in search pills

sandeepb28e12e2de15
diff --git a/web/src/search_pill.ts b/web/src/search_pill.ts
index 957a1873c4a..2eb8dfa5ad7 100644
--- a/web/src/search_pill.ts
+++ b/web/src/search_pill.ts
@@ -14,6 +14,7 @@ import type {User} from "./people.ts";
import {type Suggestion, search_term_description_html} from "./search_suggestion.ts";
import type {NarrowCanonicalTerm, NarrowTermSuggestion} from "./state_data.ts";
import * as stream_data from "./stream_data.ts";
+import type {StreamSubscription} from "./sub_store.ts";
import * as user_status from "./user_status.ts";
import type {UserStatusEmojiInfo} from "./user_status.ts";
import * as util from "./util.ts";
@@ -48,7 +49,7 @@ type PillRenderData =
topic_display_name?: string;
description_html?: string;
is_combined_channel_topic?: boolean;
- combined_channel_name?: string;
+ stream?: StreamSubscription;
})
| SearchUserPill;
@@ -166,11 +167,11 @@ function maybe_generate_combined_channel_topic_pill(
const sign = search_pill.negated ? "-" : "";
const channel_operand = search_terms[index - 1]!.operand;
- const channel_name = stream_data.get_valid_sub_by_id_string(channel_operand).name;
+ const sub = stream_data.get_valid_sub_by_id_string(channel_operand);
return {
...search_pill,
sign,
- combined_channel_name: channel_name,
+ stream: sub,
is_combined_channel_topic: true,
topic_display_name: util.get_final_topic_display_name(search_pill.operand),
is_empty_string_topic: search_pill.operand === "",
diff --git a/web/templates/input_pill.hbs b/web/templates/input_pill.hbs
index ab9d87dca03..c5865a60fe6 100644
--- a/web/templates/input_pill.hbs
+++ b/web/templates/input_pill.hbs
@@ -21,7 +21,7 @@
{{> decorated_channel_name stream=stream }}
{{else}}
{{#if is_combined_channel_topic}}
- {{sign}}#{{combined_channel_name}} &gt;<span {{#if is_empty_string_topic}}class="empty-topic-display"{{/if}}> {{topic_display_name}}</span>
+ {{sign}}{{> decorated_channel_name stream=stream inline_with_text=true show_colored_icon=false}} &gt;<span {{#if is_empty_string_topic}}class="empty-topic-display"{{/if}}> {{topic_display_name}}</span>
{{else}}
{{#if is_empty_string_topic}}
{{sign}}topic:{{#if topic_display_name}}<span class="empty-topic-display"> {{topic_display_name}}</span>{{/if}}
diff --git a/web/tests/search.test.cjs b/web/tests/search.test.cjs
index 17913edeacf..ebca4ebe7dd 100644
--- a/web/tests/search.test.cjs
+++ b/web/tests/search.test.cjs
@@ -125,7 +125,8 @@ run_test("initialize", ({override, override_rewire, mock_template}) => {
assert.equal(opts.item_html("ver")(search_suggestions[0]), expected_value);
const search_string = "channel: Verona";
- description_html = "Messages in #Verona";
+ const verona_decorated = `<span class="decorated-channel-name-wrapper inline-decorated-channel-name"><span class="channel-privacy-type-icon"><i class="zulip-icon zulip-icon-hashtag" aria-hidden="true"></i></span><span class="decorated-channel-name">Verona</span></span>`;
+ description_html = `Messages in ${verona_decorated}`;
expected_value = `<div class="search_list_item">\n <span class="pill-container"><div class='pill ' tabindex=0>\n <span class="pill-label">\n <span class="pill-value">\n${search_string}\n </span></span>\n <div class="exit">\n <a role="button" class="zulip-icon zulip-icon-close pill-close-button" aria-label="translated: Remove"></a>\n </div>\n</div>\n</span>\n <div class="description">${description_html}</div>\n</div>\n`;
assert.equal(opts.item_html("ver")(search_suggestions[1]), expected_value);