From 138c79bf7186a037676e4fc6b97be4c1c2cff6d3 Mon Sep 17 00:00:00 2001 From: Halla Moore Date: Tue, 13 Dec 2016 18:09:18 -0800 Subject: [PATCH] [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 --- packages/local-sync/src/local-api/routes/send.js | 3 +++ packages/local-sync/src/local-api/sendmail-client.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/local-sync/src/local-api/routes/send.js b/packages/local-sync/src/local-api/routes/send.js index 153c15fd6..398b56254 100644 --- a/packages/local-sync/src/local-api/routes/send.js +++ b/packages/local-sync/src/local-api/routes/send.js @@ -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); diff --git a/packages/local-sync/src/local-api/sendmail-client.js b/packages/local-sync/src/local-api/sendmail-client.js index a268fa111..310bf1605 100644 --- a/packages/local-sync/src/local-api/sendmail-client.js +++ b/packages/local-sync/src/local-api/sendmail-client.js @@ -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) }