mirror of https://github.com/zulip/zulip.git
(search) Don't show topic suggestions when a topic is already entered.
We already had provisions for the common case, but this code fixes the situation where the user explicitly types topic:foo stream:yo. (imported from commit 4dfa4cc8337acd4f0daed25a5b82a556804b3c18)
This commit is contained in:
parent
8e23848384
commit
84fda6ad04
|
@ -167,6 +167,7 @@ function get_topic_suggestions(query, query_operators, max_num) {
|
||||||
var operand = last_term[1];
|
var operand = last_term[1];
|
||||||
var stream;
|
var stream;
|
||||||
var guess;
|
var guess;
|
||||||
|
var filter;
|
||||||
|
|
||||||
// stream:Rome -> show all Rome topics
|
// stream:Rome -> show all Rome topics
|
||||||
// stream:Rome topic: -> show all Rome topics
|
// stream:Rome topic: -> show all Rome topics
|
||||||
|
@ -185,6 +186,10 @@ function get_topic_suggestions(query, query_operators, max_num) {
|
||||||
// i.e. "foo" and "search:foo" both become [['search', 'foo']].
|
// i.e. "foo" and "search:foo" both become [['search', 'foo']].
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case 'stream':
|
case 'stream':
|
||||||
|
filter = new narrow.Filter(query_operators);
|
||||||
|
if (filter.has_operator('topic')) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
guess = '';
|
guess = '';
|
||||||
stream = operand;
|
stream = operand;
|
||||||
break;
|
break;
|
||||||
|
@ -192,7 +197,7 @@ function get_topic_suggestions(query, query_operators, max_num) {
|
||||||
case 'search':
|
case 'search':
|
||||||
guess = operand;
|
guess = operand;
|
||||||
query_operators = query_operators.slice(0, -1);
|
query_operators = query_operators.slice(0, -1);
|
||||||
var filter = new narrow.Filter(query_operators);
|
filter = new narrow.Filter(query_operators);
|
||||||
if (filter.has_operator('topic')) {
|
if (filter.has_operator('topic')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue