desktop_notification: Fix error when message deleted while narrowing.

Earlier:
When a user clicked the desktop notification, but before we finished
processing that click, the message deletion got processed.
It resulted in an error.

This commit fixes the bug by taking the user to the conversation
where the now-deleted message had been prior to deletion -
narrow to the message's near view.

Signed-off-by: Prakhar Pratyush <prakhar@zulip.com>
This commit is contained in:
Prakhar Pratyush
2025-10-30 23:06:11 +05:30
committed by Tim Abbott
parent 84bb07a652
commit e15edc84c2
3 changed files with 36 additions and 25 deletions

View File

@@ -1473,30 +1473,8 @@ function process_hotkey(e: JQuery.KeyDownEvent, hotkey: Hotkey): boolean {
// The following code is essentially equivalent to
// `window.location = hashutil.by_conversation_and_time_url(msg)`
// but we use `message_view.show` to pass in the `trigger` parameter
switch (msg.type) {
case "private":
message_view.show(
[
{operator: "dm", operand: msg.reply_to},
{operator: "near", operand: String(msg.id)},
],
{trigger: "hotkey"},
);
return true;
case "stream":
message_view.show(
[
{
operator: "channel",
operand: msg.stream_id.toString(),
},
{operator: "topic", operand: msg.topic},
{operator: "near", operand: String(msg.id)},
],
{trigger: "hotkey"},
);
return true;
}
message_view.narrow_to_message_near(msg, "hotkey");
return true;
}
}