mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
Extract 'verb' variable in Filter functions.
Extract 'verb' in Filter.operator_to_prefix() and Filter.describe(). This doesn't change any functionality; it is designed to make a subsequent change have a less noisy diff. (imported from commit e9c4b6edc498d88ec1783ccdba079d980def9438)
This commit is contained in:
@@ -358,30 +358,35 @@ Filter.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Filter.operator_to_prefix = function (operator) {
|
Filter.operator_to_prefix = function (operator) {
|
||||||
|
var verb;
|
||||||
|
|
||||||
|
if (operator === 'search') {
|
||||||
|
return 'Search for';
|
||||||
|
}
|
||||||
|
|
||||||
|
verb = 'Narrow to ';
|
||||||
|
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case 'stream':
|
case 'stream':
|
||||||
return 'Narrow to stream';
|
return verb + 'stream';
|
||||||
|
|
||||||
case 'near':
|
case 'near':
|
||||||
return 'Narrow to messages around';
|
return verb + 'messages around';
|
||||||
|
|
||||||
case 'id':
|
case 'id':
|
||||||
return 'Narrow to message ID';
|
return verb + 'message ID';
|
||||||
|
|
||||||
case 'topic':
|
case 'topic':
|
||||||
return 'Narrow to topic';
|
return verb + 'topic';
|
||||||
|
|
||||||
case 'sender':
|
case 'sender':
|
||||||
return 'Narrow to messages sent by';
|
return verb + 'messages sent by';
|
||||||
|
|
||||||
case 'pm-with':
|
case 'pm-with':
|
||||||
return 'Narrow to private messages with';
|
return verb + 'private messages with';
|
||||||
|
|
||||||
case 'search':
|
|
||||||
return 'Search for';
|
|
||||||
|
|
||||||
case 'in':
|
case 'in':
|
||||||
return 'Narrow to messages in';
|
return verb + 'messages in';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
@@ -408,14 +413,15 @@ Filter.describe = function (operators) {
|
|||||||
var operand = elem.operand;
|
var operand = elem.operand;
|
||||||
var canonicalized_operator = Filter.canonicalize_operator(elem.operator);
|
var canonicalized_operator = Filter.canonicalize_operator(elem.operator);
|
||||||
if (canonicalized_operator ==='is') {
|
if (canonicalized_operator ==='is') {
|
||||||
|
var verb = 'Narrow to ';
|
||||||
if (operand === 'private') {
|
if (operand === 'private') {
|
||||||
return 'Narrow to all private messages';
|
return verb + 'all private messages';
|
||||||
} else if (operand === 'starred') {
|
} else if (operand === 'starred') {
|
||||||
return 'Narrow to starred messages';
|
return verb + 'starred messages';
|
||||||
} else if (operand === 'mentioned') {
|
} else if (operand === 'mentioned') {
|
||||||
return 'Narrow to mentioned messages';
|
return verb + 'mentioned messages';
|
||||||
} else if (operand === 'alerted') {
|
} else if (operand === 'alerted') {
|
||||||
return 'Narrow to alerted messages';
|
return verb + 'alerted messages';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var prefix_for_operator = Filter.operator_to_prefix(canonicalized_operator);
|
var prefix_for_operator = Filter.operator_to_prefix(canonicalized_operator);
|
||||||
|
|||||||
Reference in New Issue
Block a user