compose_banner: Fix automatic visibility policy banner rendering.

Earlier when a new user sent a message in empty string topic,
it resulted in an error while displaying the automatic new
visibility policy banner.

'topic_name' was missing.

This commit fixes the bug.
This commit is contained in:
Prakhar Pratyush
2025-02-27 23:44:51 +05:30
committed by Tim Abbott
parent 390ab9d7c5
commit b1ddb2d5a9

View File

@@ -44,6 +44,7 @@ type MessageRecipient =
| {
message_type: "channel";
channel_name: string;
topic_name: string;
topic_display_name: string;
is_empty_string_topic: boolean;
}
@@ -91,6 +92,8 @@ export function notify_automatic_new_visibility_policy(
classname: compose_banner.CLASSNAMES.automatic_new_visibility_policy,
link_msg_id: data.id,
channel_name: message_recipient.channel_name,
// The base compose_banner.hbs expects a data-topic-name.
topic_name: message_recipient.topic_name,
topic_display_name: message_recipient.topic_display_name,
is_empty_string_topic: message_recipient.is_empty_string_topic,
narrow_url,
@@ -110,6 +113,7 @@ function get_message_recipient(message: Message): MessageRecipient {
const channel_message_recipient: MessageRecipient = {
message_type: "channel",
channel_name: stream_data.get_stream_name_from_id(message.stream_id),
topic_name: message.topic,
topic_display_name: util.get_final_topic_display_name(message.topic),
is_empty_string_topic: message.topic === "",
};