diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js index cc63d780da..aa40fadac2 100644 --- a/frontend_tests/node_tests/search_suggestion.js +++ b/frontend_tests/node_tests/search_suggestion.js @@ -422,6 +422,13 @@ run_test('group_suggestions', () => { "pm-with:jeff@zulip.com,ted@zulip.com", ]; 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(); diff --git a/frontend_tests/node_tests/search_suggestion_legacy.js b/frontend_tests/node_tests/search_suggestion_legacy.js index 9c98066855..b40f85930e 100644 --- a/frontend_tests/node_tests/search_suggestion_legacy.js +++ b/frontend_tests/node_tests/search_suggestion_legacy.js @@ -426,6 +426,15 @@ run_test('group_suggestions', () => { "pm-with:jeff@zulip.com,ted@zulip.com", ]; 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(); diff --git a/static/js/search_suggestion.js b/static/js/search_suggestion.js index bbc4cd8159..09d9feb631 100644 --- a/static/js/search_suggestion.js +++ b/static/js/search_suggestion.js @@ -588,7 +588,7 @@ exports.get_suggestions = function (base_query, query) { last.operator === 'search' && person_suggestion_ops.indexOf(query_operators[query_operators_len - 2].operator) !== -1) { 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 = { operator: person_op.operator, operand: person_op.operand + ' ' + last.operand, @@ -713,7 +713,7 @@ exports.get_suggestions_legacy = function (query) { last.operator === 'search' && person_suggestion_ops.indexOf(operators[operators_len - 2].operator) !== -1) { 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 = { operator: person_op.operator, operand: person_op.operand + ' ' + last.operand,