mirror of https://github.com/zulip/zulip.git
filter: Fix bug where invalid stream name could throw an error.
This commit is contained in:
parent
758fdc87e0
commit
7bff149325
|
@ -724,14 +724,17 @@ export class Filter {
|
|||
Filter.canonicalize_operator(term.operator) === expected && !term.negated;
|
||||
|
||||
if (is(terms[0], "channel") && is(terms[1], "topic")) {
|
||||
const channel = stream_data.get_valid_sub_by_id_string(terms[0].operand).name;
|
||||
const topic = terms[1].operand;
|
||||
parts.push({
|
||||
type: "channel_topic",
|
||||
channel,
|
||||
topic,
|
||||
});
|
||||
terms = terms.slice(2);
|
||||
// `channel` might be undefined if it's coming from a text query
|
||||
const channel = stream_data.get_sub_by_id_string(terms[0].operand)?.name;
|
||||
if (channel) {
|
||||
const topic = terms[1].operand;
|
||||
parts.push({
|
||||
type: "channel_topic",
|
||||
channel,
|
||||
topic,
|
||||
});
|
||||
terms = terms.slice(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue