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.

compose_closed_ui: Restore label_text for stream/topic recipients.

0xthedance82f119d62c71
diff --git a/web/src/compose_closed_ui.ts b/web/src/compose_closed_ui.ts
index 5ad621268cf..cf727fca895 100644
--- a/web/src/compose_closed_ui.ts
+++ b/web/src/compose_closed_ui.ts
@@ -17,8 +17,12 @@ import * as stream_data from "./stream_data.ts";
import type {StreamSubscription} from "./sub_store.ts";
import * as util from "./util.ts";
+// `label_text` is a flat, pre-formatted string used by the call-creation
+// paths in compose_call_ui.ts to build a meeting/room name.
+// The reply-button template uses the structured `stream` / `topic_display_name`
+// fields instead, so it can render the decorated channel icon.
type RecipientLabel = {
- label_text?: string;
+ label_text: string;
has_empty_string_topic?: boolean;
stream?: StreamSubscription;
topic_display_name?: string;
@@ -31,6 +35,7 @@ function get_stream_recipient_label(stream_id: number, topic: string): Recipient
const topic_display_name = util.get_final_topic_display_name(topic);
if (stream) {
const recipient_label: RecipientLabel = {
+ label_text: `#${stream.name} > ${topic_display_name}`,
has_empty_string_topic: topic === "",
stream,
topic_display_name,
diff --git a/web/tests/compose_closed_ui.test.cjs b/web/tests/compose_closed_ui.test.cjs
index 974fe6769ff..938d85aca39 100644
--- a/web/tests/compose_closed_ui.test.cjs
+++ b/web/tests/compose_closed_ui.test.cjs
@@ -251,6 +251,34 @@ run_test("test_non_message_list_input", ({mock_template}) => {
assert.equal(label, "translated: Compose message");
});
+run_test("recipient_label_text_for_call_creation", () => {
+ recent_view_util.is_visible = () => true;
+ message_lists.current = undefined;
+ const stream = make_stream({
+ subscribed: true,
+ name: "stream test",
+ stream_id: 11,
+ });
+ stream_data.add_sub_for_tests(stream);
+
+ assert.equal(
+ compose_closed_ui.get_recipient_label({
+ stream_id: stream.stream_id,
+ topic: "topic test",
+ })?.label_text,
+ "#stream test > topic test",
+ );
+
+ // Empty topic falls back to the realm's empty-topic display name.
+ assert.equal(
+ compose_closed_ui.get_recipient_label({
+ stream_id: stream.stream_id,
+ topic: "",
+ })?.label_text,
+ `#stream test > translated: ${REALM_EMPTY_TOPIC_DISPLAY_NAME}`,
+ );
+});
+
run_test("update_reply_button_state", ({override, override_rewire}) => {
const $compose_reply_wrapper = $("#legacy-closed-compose-box .compose-reply-button-wrapper");
const $reply_button = $(".compose_reply_button");