search: Display invalid operand suggestion for `is` operator.

Fixes #9492.
`is` operator uses predefined categories. This commit
displays an invalid operand message if the operand does not fall into
any of these categories and the `is` operator is not at the last.
e.g. `is:abc sender:abc@zulipchat.com` will have `invalid abc operand
for has operator, sent by abc@zulipchat.com` as a prefix for all its
suggestions.
This commit is contained in:
Shubham Padia 2018-05-22 18:22:43 +05:30
parent e5b3fb332b
commit a5db885d62
2 changed files with 2 additions and 2 deletions

View File

@ -627,7 +627,7 @@ run_test('describe', () => {
narrow = [
{operator: 'is', operand: 'something_we_do_not_support'},
];
string = 'something_we_do_not_support messages';
string = 'invalid something_we_do_not_support operand for is operator';
assert.equal(Filter.describe(narrow), string);
// this should be unreachable, but just in case

View File

@ -622,7 +622,7 @@ function describe_unescaped(operators) {
} else if (operand === 'unread') {
return verb + 'unread messages';
}
return operand + ' messages';
return 'invalid ' + operand + ' operand for is operator';
}
if (canonicalized_operator ==='has') {
// search_suggestion.get_suggestions takes care that this message will