Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_fetch: Don't allow undefined narrow term operands.
evykassirerb2e1c5aec498
diff --git a/web/src/message_fetch.ts b/web/src/message_fetch.tsindex f91281d383b..8bdc248f864 100644--- a/web/src/message_fetch.ts+++ b/web/src/message_fetch.ts@@ -349,10 +349,12 @@ export function load_messages(opts: MessageFetchOptions, attempt = 1): void {const sub = stream_data.get_sub_by_id_string(term.operand);server_terms.push({...term,- // If the sub is undefined, we'll get an error which is handled- // later by showing a "this channel does not exist or is private"- // notice.- operand: sub?.name,+ // If we can't find the sub, we shouldn't send `undefined`+ // because we want to preserve the NarrowTerm type, so we just+ // send the unknown stream id.+ // This should show a "this channel does not exist or is private"+ // notice (both logged in and logged out).+ operand: sub?.name ?? term.operand,});} else {server_terms.push({...term});