From 0902d99678366ac71765257276d1a54213f4882a Mon Sep 17 00:00:00 2001 From: Halla Moore Date: Tue, 17 Jan 2017 07:49:05 -0800 Subject: [PATCH] fix(onboarding): Change how we determine default IMAP settings Summary: If we don't have IMAP settings for a particular email domain, try to choose based on which provider was selected instead. Fixes #3168 Test Plan: tested locally Reviewers: spang, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3721 --- .../lib/common-provider-settings.json | 42 +++++++++++++++++++ .../onboarding/lib/onboarding-helpers.es6 | 4 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/internal_packages/onboarding/lib/common-provider-settings.json b/internal_packages/onboarding/lib/common-provider-settings.json index 32b7a7965..a3642e3b6 100644 --- a/internal_packages/onboarding/lib/common-provider-settings.json +++ b/internal_packages/onboarding/lib/common-provider-settings.json @@ -1,4 +1,46 @@ { + "yahoo": { + "imap_port": "993", + "smtp_port": "587", + "smtp_user_format": "email", + "imap_user_format": "email", + "ssl": "1", + "smtp_custom_config": { + "host": "smtp.mail.yahoo.com", + "port": 587, + "secure": false, + "tls": {"ciphers": "SSLv3"} + }, + "imap_host": "imap.mail.yahoo.com", + "smtp_host": "smtp.mail.yahoo.com", + "occurences": 2083 + }, + "fastmail": { + "imap_host": "imap.fastmail.com", + "imap_port": "993", + "smtp_host": "smtp.fastmail.com", + "smtp_port": "465", + "smtp_user_format": "email", + "imap_user_format": "email", + "ssl": "1", + "occurences": 68 + }, + "icloud": { + "imap_port": "993", + "smtp_port": "587", + "smtp_user_format": "email", + "imap_user_format": "email", + "ssl": "1", + "smtp_custom_config": { + "host": "smtp.mail.me.com", + "port": 587, + "secure": false, + "tls": {"ciphers": "SSLv3"} + }, + "imap_host": "imap.mail.me.com", + "smtp_host": "smtp.mail.me.com", + "occurences": 1624 + }, "yahoo.com": { "imap_port": "993", "smtp_port": "587", diff --git a/internal_packages/onboarding/lib/onboarding-helpers.es6 b/internal_packages/onboarding/lib/onboarding-helpers.es6 index 8c27e635f..24ffe0846 100644 --- a/internal_packages/onboarding/lib/onboarding-helpers.es6 +++ b/internal_packages/onboarding/lib/onboarding-helpers.es6 @@ -172,9 +172,9 @@ export function isValidHost(value) { export function accountInfoWithIMAPAutocompletions(existingAccountInfo) { const CommonProviderSettings = require('./common-provider-settings.json'); - const email = existingAccountInfo.email; + const {email, type} = existingAccountInfo; const domain = email.split('@').pop().toLowerCase(); - const template = CommonProviderSettings[domain] || {}; + const template = CommonProviderSettings[domain] || CommonProviderSettings[type] || {}; const usernameWithFormat = (format) => { if (format === 'email') {