mirror of https://github.com/zulip/zulip.git
compose: Ensure valid destination stream in typeahead completion.
If we complete a typeahead with an invalid stream name in composebox, we would get 'compose_stream is undefined' error while running the checks to prevent accidentally mentioning private streams. We can safely early-return from this function and let the 'send' event handler show the error to the user.
This commit is contained in:
parent
5d20c4b8fb
commit
3f03ae66f0
|
@ -962,6 +962,12 @@ exports.initialize = function () {
|
|||
}
|
||||
|
||||
var compose_stream = stream_data.get_sub(compose_state.stream_name());
|
||||
if (compose_stream === undefined) {
|
||||
// We have an invalid stream name, don't warn about this here as
|
||||
// we show an error to the user when they try to send the message.
|
||||
return;
|
||||
}
|
||||
|
||||
if (compose_stream.subscribers && data.stream.subscribers) {
|
||||
var compose_stream_sub = compose_stream.subscribers.keys();
|
||||
var mentioned_stream_sub = data.stream.subscribers.keys();
|
||||
|
|
Loading…
Reference in New Issue