[client-sync] Fix contact ranking error

Summary:
This was showing up in Sentry. Check to see if the recipient has an email
before calling toLowerCase.

Test Plan: yolo

Reviewers: halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4423
This commit is contained in:
Mark Hahnenberg 2017-04-13 16:06:48 -07:00
parent 91f5ca4de9
commit b1123433d0

View file

@ -16,6 +16,9 @@ const calculateContactScores = (messages, result) => {
for (const message of messages) {
const weight = getMessageWeight(message, now);
for (const recipient of message.getRecipients()) {
if (!recipient.email) {
continue;
}
const email = recipient.email.toLowerCase();
result[email] = result[email] ? (result[email] + weight) : weight;
}