mirror of https://github.com/zulip/zulip.git
search: Fix searching and search suggestion in Group PM.
Fix the .get_suggestions and .get_suggestions_legacy to correctly handle search terms in group PM and treat it as search term by not concatenating it at end of pm-with email list operand.
This commit is contained in:
parent
bf9e0c3239
commit
487861554f
|
@ -422,6 +422,13 @@ run_test('group_suggestions', () => {
|
||||||
"pm-with:jeff@zulip.com,ted@zulip.com",
|
"pm-with:jeff@zulip.com,ted@zulip.com",
|
||||||
];
|
];
|
||||||
assert.deepEqual(suggestions.strings, expected);
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
|
|
||||||
|
query = "pm-with:jeff@zulip.com,ted@zulip.com hi";
|
||||||
|
suggestions = search.get_suggestions("", query);
|
||||||
|
expected = [
|
||||||
|
"pm-with:jeff@zulip.com,ted@zulip.com hi",
|
||||||
|
];
|
||||||
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
|
@ -426,6 +426,15 @@ run_test('group_suggestions', () => {
|
||||||
"pm-with:jeff@zulip.com,ted@zulip.com",
|
"pm-with:jeff@zulip.com,ted@zulip.com",
|
||||||
];
|
];
|
||||||
assert.deepEqual(suggestions.strings, expected);
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
|
|
||||||
|
query = "pm-with:jeff@zulip.com,ted@zulip.com hi";
|
||||||
|
suggestions = search.get_suggestions_legacy(query);
|
||||||
|
expected = [
|
||||||
|
"pm-with:jeff@zulip.com,ted@zulip.com hi",
|
||||||
|
"pm-with:jeff@zulip.com,ted@zulip.com",
|
||||||
|
];
|
||||||
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
|
@ -588,7 +588,7 @@ exports.get_suggestions = function (base_query, query) {
|
||||||
last.operator === 'search' &&
|
last.operator === 'search' &&
|
||||||
person_suggestion_ops.indexOf(query_operators[query_operators_len - 2].operator) !== -1) {
|
person_suggestion_ops.indexOf(query_operators[query_operators_len - 2].operator) !== -1) {
|
||||||
var person_op = query_operators[query_operators_len - 2];
|
var person_op = query_operators[query_operators_len - 2];
|
||||||
if (!people.get_by_email(person_op.operand)) {
|
if (!people.reply_to_to_user_ids_string(person_op.operand)) {
|
||||||
last = {
|
last = {
|
||||||
operator: person_op.operator,
|
operator: person_op.operator,
|
||||||
operand: person_op.operand + ' ' + last.operand,
|
operand: person_op.operand + ' ' + last.operand,
|
||||||
|
@ -713,7 +713,7 @@ exports.get_suggestions_legacy = function (query) {
|
||||||
last.operator === 'search' &&
|
last.operator === 'search' &&
|
||||||
person_suggestion_ops.indexOf(operators[operators_len - 2].operator) !== -1) {
|
person_suggestion_ops.indexOf(operators[operators_len - 2].operator) !== -1) {
|
||||||
var person_op = operators[operators_len - 2];
|
var person_op = operators[operators_len - 2];
|
||||||
if (!people.get_by_email(person_op.operand)) {
|
if (!people.reply_to_to_user_ids_string(person_op.operand)) {
|
||||||
last = {
|
last = {
|
||||||
operator: person_op.operator,
|
operator: person_op.operator,
|
||||||
operand: person_op.operand + ' ' + last.operand,
|
operand: person_op.operand + ' ' + last.operand,
|
||||||
|
|
Loading…
Reference in New Issue