mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Support has:attachment/has:image/has:link searches.
This commit finishes up support for has:* searches by adding the front-end pieces, specifically the part that "has" operators will not be applied locally. It also implements basic descriptions for search suggestions and canonicalization of operands from plural to singular. (imported from commit a3285bc33d06d76b5a2b403ebcdd911b4cc03980)
This commit is contained in:
@@ -144,6 +144,11 @@ Filter.canonicalize_term = function (opts) {
|
||||
operator = Filter.canonicalize_operator(operator);
|
||||
|
||||
switch (operator) {
|
||||
case 'has':
|
||||
// images -> image, etc.
|
||||
operand = operand.replace(/s$/, '');
|
||||
break;
|
||||
|
||||
case 'stream':
|
||||
operand = stream_data.get_name(operand);
|
||||
break;
|
||||
@@ -318,7 +323,7 @@ Filter.prototype = {
|
||||
},
|
||||
|
||||
can_apply_locally: function Filter_can_apply_locally() {
|
||||
return ! this.is_search();
|
||||
return (!this.is_search()) && (!this.has_operator('has'));
|
||||
},
|
||||
|
||||
_canonicalize_operators: function Filter__canonicalize_operators(operators_mixed_case) {
|
||||
@@ -367,6 +372,9 @@ Filter.operator_to_prefix = function (operator, negated) {
|
||||
case 'near':
|
||||
return verb + 'messages around';
|
||||
|
||||
case 'has':
|
||||
return verb + 'messages with one or more';
|
||||
|
||||
case 'id':
|
||||
return verb + 'message ID';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user