[local-sync] Fix contact validation

Summary:
Allow other fields to be passed in with participants, so that Contact
objects can be passed in as JSON. Also fix an error check.

Test Plan: tested locally

Reviewers: jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3504
This commit is contained in:
Halla Moore 2016-12-13 18:09:18 -08:00
parent c214ba1e34
commit 138c79bf71
2 changed files with 4 additions and 1 deletions

View file

@ -9,10 +9,13 @@ const SEND_TIMEOUT = 1000 * 60; // millliseconds
const recipient = Joi.object().keys({
name: Joi.string().required(),
email: Joi.string().email().required(),
// Rest are optional
account_id: Joi.string(),
client_id: Joi.string(),
id: Joi.string(),
thirdPartyData: Joi.object(),
server_id: Joi.string(),
object: Joi.string(),
});
const recipientList = Joi.array().items(recipient);

View file

@ -52,7 +52,7 @@ class SendmailClient {
// TODO: figure out how to parse different errors, like in cloud-core
// https://github.com/nylas/cloud-core/blob/production/sync-engine/inbox/sendmail/smtp/postel.py#L354
if (err.message.startsWith("Error: Invalid login: 535-5.7.8 Username and Password not accepted.")) {
if (err.message.startsWith("Invalid login: 535-5.7.8 Username and Password not accepted.")) {
throw new HTTPError('Invalid login', 401, err)
}