message_view_header: Add blueslip logging for undefined sub.

To try to figure out why this is happening:
https://chat.zulip.org/#narrow/stream/464-kandra-js-errors/topic/Error.3A.20Failed.20to.20process.20an.20event
This commit is contained in:
evykassirer
2024-09-30 15:05:14 -07:00
committed by Tim Abbott
parent 2440c6d244
commit 12033d6690

View File

@@ -3,6 +3,7 @@ import assert from "minimalistic-assert";
import render_message_view_header from "../templates/message_view_header.hbs";
import * as blueslip from "./blueslip";
import type {Filter} from "./filter";
import * as hash_util from "./hash_util";
import {$t} from "./i18n";
@@ -133,7 +134,13 @@ export function colorize_message_view_header(): void {
const filter = narrow_state.filter();
let current_sub;
if (filter?.has_operator("channel")) {
current_sub = stream_data.get_valid_sub_by_id_string(filter.operands("channel")[0]!);
current_sub = stream_data.get_sub_by_id_string(filter.operands("channel")[0]!);
if (current_sub === undefined) {
blueslip.error("Unexpected undefined sub", {
stream_id: filter.operands("channel")[0],
filter,
});
}
}
if (!current_sub) {
return;