mirror of https://github.com/zulip/zulip.git
Show topic suggestions as "Narrow to stream > topic".
Terse suggestions are better for scanning, and we reinforce the ">" convention. (imported from commit f586b74b29088e4cd76797aa5305d97fab34832f)
This commit is contained in:
parent
84fda6ad04
commit
f177147f7a
|
@ -36,7 +36,19 @@ function stream_matches_query(stream_name, q) {
|
|||
|
||||
// Convert a list of operators to a human-readable description.
|
||||
function describe(operators) {
|
||||
return $.map(operators, function (elem) {
|
||||
var parts = [];
|
||||
|
||||
if (operators.length >= 2) {
|
||||
if (operators[0][0] === 'stream' && operators[1][0] === 'topic') {
|
||||
var stream = operators[0][1];
|
||||
var topic = operators[1][1];
|
||||
var part = 'Narrow to ' + stream + ' > ' + topic;
|
||||
parts = [part];
|
||||
operators = operators.slice(2);
|
||||
}
|
||||
}
|
||||
|
||||
var more_parts = $.map(operators, function (elem) {
|
||||
var operand = elem[1];
|
||||
switch (narrow.canonicalize_operator(elem[0])) {
|
||||
case 'is':
|
||||
|
@ -68,7 +80,8 @@ function describe(operators) {
|
|||
return 'Narrow to messages in ' + operand;
|
||||
}
|
||||
return 'Narrow to (unknown operator)';
|
||||
}).join(', ');
|
||||
});
|
||||
return parts.concat(more_parts).join(', ');
|
||||
}
|
||||
|
||||
function narrow_or_search_for_term(item) {
|
||||
|
|
Loading…
Reference in New Issue