Use user ids in JS-side "pm-with" filter.

We now convert our pm-with search operand to a list of user ids
for matching against messages, rather than using emails.  On the
message side we look at user ids from display_recipient.
This commit is contained in:
Steve Howell
2017-02-08 13:10:06 -08:00
committed by Tim Abbott
parent c2e9690e34
commit 12c4478a3f
3 changed files with 42 additions and 5 deletions

View File

@@ -101,9 +101,19 @@ function message_matches_search_term(message, operator, operand) {
case 'pm-with':
// TODO: use user_ids, not emails here
return (message.type === 'private') &&
(util.normalize_recipients(message.reply_to) ===
util.normalize_recipients(operand));
if (message.type !== 'private') {
return false;
}
var operand_ids = people.pm_with_operand_ids(operand);
if (!operand_ids) {
return false;
}
var message_ids = people.pm_with_user_ids(message);
if (!message_ids) {
return false;
}
return _.isEqual(operand_ids, message_ids);
}
return true; // unknown operators return true (effectively ignored)