mirror of https://github.com/zulip/zulip.git
refactor: Use early-exits in can_apply_locally().
The early-exit style is nice for writing longer comments about edge cases.
This commit is contained in:
parent
e9cd0ad3d6
commit
e1fdb96882
|
@ -372,7 +372,23 @@ Filter.prototype = {
|
|||
},
|
||||
|
||||
can_apply_locally: function () {
|
||||
return !this.is_search() && !this.has_operator('has');
|
||||
if (this.is_search()) {
|
||||
// The semantics for matching keywords are implemented
|
||||
// by database plugins, and we don't have JS code for
|
||||
// that, plus search queries tend to go too far back in
|
||||
// history.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.has_operator('has')) {
|
||||
// See #6186 to see why we currently punt on 'has:foo'
|
||||
// queries. This can be fixed, there are just some random
|
||||
// complications that make it non-trivial.
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we get this far, we're good!
|
||||
return true;
|
||||
},
|
||||
|
||||
_canonicalize_operators: function (operators_mixed_case) {
|
||||
|
|
Loading…
Reference in New Issue