mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
Allow negated has:* searches.
Before this change, we were incorrectly trying to do local filtering on negated has searches. (imported from commit d1a6f1feef6b3cc1c984eb91a73cd16c4e66874e)
This commit is contained in:
@@ -311,7 +311,7 @@ Filter.prototype = {
|
||||
|
||||
has_operator: function Filter_has_operator(operator) {
|
||||
return _.any(this._operators, function (elem) {
|
||||
if (elem.negated && (elem.operator !== 'search')) {
|
||||
if (elem.negated && (!_.contains(['search', 'has'], elem.operator))) {
|
||||
return false;
|
||||
}
|
||||
return elem.operator === operator;
|
||||
|
||||
@@ -78,7 +78,15 @@ function assert_same_operators(result, terms) {
|
||||
];
|
||||
filter = new Filter(operators);
|
||||
assert(filter.has_operator('search'));
|
||||
assert(! filter.can_apply_locally());
|
||||
assert(!filter.can_apply_locally());
|
||||
|
||||
// Similar logic applies to negated "has" searches.
|
||||
operators = [
|
||||
{operator: 'has', operand: 'images', negated: true}
|
||||
];
|
||||
filter = new Filter(operators);
|
||||
assert(filter.has_operator('has'));
|
||||
assert(!filter.can_apply_locally());
|
||||
}());
|
||||
|
||||
(function test_new_style_operators() {
|
||||
|
||||
Reference in New Issue
Block a user