echo: Fix incorrect check for message `topic`.

The actual check should be for `falsy` (to handle empty string)
and not undefined, since topic is an empty string for
private messages.
This commit is contained in:
Varun Singh 2024-07-21 23:17:14 +05:30 committed by Tim Abbott
parent 2e12d3cd25
commit 3dd8a4c6d5
2 changed files with 1 additions and 2 deletions

View File

@ -172,7 +172,7 @@ export function insert_local_message(message_request, local_id_float, insert_new
message.local_id = local_id_float.toString(); message.local_id = local_id_float.toString();
message.locally_echoed = true; message.locally_echoed = true;
message.id = local_id_float; message.id = local_id_float;
if (message.topic === undefined) { if (!message.topic) {
message.topic_links = []; message.topic_links = [];
} else { } else {
message.topic_links = markdown.get_topic_links(message.topic); message.topic_links = markdown.get_topic_links(message.topic);

View File

@ -266,7 +266,6 @@ test_ui("send_message", ({override, override_rewire, mock_template}) => {
const server_message_id = 127; const server_message_id = 127;
override(markdown, "render", noop); override(markdown, "render", noop);
override(markdown, "get_topic_links", noop);
override_rewire(echo, "try_deliver_locally", (message_request) => { override_rewire(echo, "try_deliver_locally", (message_request) => {
const local_id_float = 123.04; const local_id_float = 123.04;