mirror of https://github.com/zulip/zulip.git
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:
parent
e5b3fb332b
commit
a5db885d62
|
@ -627,7 +627,7 @@ run_test('describe', () => {
|
||||||
narrow = [
|
narrow = [
|
||||||
{operator: 'is', operand: 'something_we_do_not_support'},
|
{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);
|
assert.equal(Filter.describe(narrow), string);
|
||||||
|
|
||||||
// this should be unreachable, but just in case
|
// this should be unreachable, but just in case
|
||||||
|
|
|
@ -622,7 +622,7 @@ function describe_unescaped(operators) {
|
||||||
} else if (operand === 'unread') {
|
} else if (operand === 'unread') {
|
||||||
return verb + 'unread messages';
|
return verb + 'unread messages';
|
||||||
}
|
}
|
||||||
return operand + ' messages';
|
return 'invalid ' + operand + ' operand for is operator';
|
||||||
}
|
}
|
||||||
if (canonicalized_operator ==='has') {
|
if (canonicalized_operator ==='has') {
|
||||||
// search_suggestion.get_suggestions takes care that this message will
|
// search_suggestion.get_suggestions takes care that this message will
|
||||||
|
|
Loading…
Reference in New Issue