compose: Fix bug on sending message to invalid streams.

The issue is that we were trying to validate the mentions before
checking that the recipient stream was valid, leading to problems
checking the membership of the stream.

Fixes #3040.
This commit is contained in:
Sampriti Panda 2017-01-05 16:40:47 +05:30 committed by Tim Abbott
parent c15d1ff343
commit 45a5e47e1b
1 changed files with 2 additions and 6 deletions

View File

@ -808,10 +808,6 @@ function validate_stream_message_address_info(stream_name) {
"<p>Manage your subscriptions <a href='#subscriptions'>on your Streams page</a>.</p>";
compose_error(response, $('#stream'));
return false;
case "subscribed":
// You're actually subscribed to the stream, but this
// browser window doesn't know it.
return true;
case "error":
return false;
case "not-subscribed":
@ -841,8 +837,8 @@ function validate_stream_message() {
}
}
if (!validate_stream_message_mentions(stream_name) ||
!validate_stream_message_address_info(stream_name)) {
if (!validate_stream_message_address_info(stream_name) ||
!validate_stream_message_mentions(stream_name)) {
return false;
}