Commit graph

5857 commits

Author SHA1 Message Date
BinHong Lee 0d8f85afa7 Fix broken image url in README.md (#3349) 2017-04-17 17:17:27 -07:00
Juan Tejada be5c3d27e5 Merge private repo 2017-04-17 17:17:05 -07:00
Juan Tejada 1f9e2e0886 [client-app] Update changelog 2017-04-17 11:42:00 -07:00
Mark Hahnenberg 92c3d8c608 [client-app] Fix benchmark mode
Summary:
We weren't passing benchmarkMode through in the default window options,
so the worker window (or any other spawned window) would think it wasn't in
benchmark mode.

Test Plan:
Run locally, verify that the worker window thinks it's in
benchmark mode

Reviewers: halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4427
2017-04-17 11:29:02 -07:00
Nylas Coffee Machine 8b9d98c5e2 bump(version): 2.0.15 2017-04-17 10:46:44 -07:00
Juan Tejada 4a25f6388c [client-app] Database malformed errors shouldn't be retryable
Summary:
Given that this error is unrecoverable it shouldn't be retryable.
Additionally, this commit improves error handling for this error in a
few ways:

- Don't delete all databases, just edgehill.db which is the one we know is corrupted. (Use `handleDatabaseUnrecoverableError` instead of `Actions.resetEmailCache`)
- Message the user about the database being reset so the app doesn't restart without notice, and make sure that this message is only displayed once by moving it to the main process

Test Plan: manual

Reviewers: mark, spang, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4433
2017-04-17 10:45:39 -07:00
Juan Tejada ad50fdeaf0 [client-app] When resetting database, make sure to re-init db reader
Summary: see title

Test Plan: manual

Reviewers: halla, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4432
2017-04-17 10:32:08 -07:00
Juan Tejada 26868f6f9b [client-app] Correctly handle db malformed errors in main process
Summary:
This commit addressess issue T8135, which prevents the app from
starting.

This was happening because when 3111c166 landed, we added database
access from the main (backend) electron process to be able to read the
identity now stored in the database: https://github.com/nylas/nylas-mail/commit/3111c166#diff-1efa26fa0ae1603366b2c0033d971028R44
However, we omitted to add any error handling, so if the database failed to open
due to a database malformed error (which it does:
https://sentry.io/nylas/nylas-mail/?query=is%3Aunresolved+release%3A2.0.14+malformed&statsPeriod=14d), the app will just fail to start,
given that this happens during the initialization of the main process.
Additionally, the fact that we had no error handling increased the error
reports for malformed errors given that we would never handle them, so
every-time we opened the app we would report the same error

This commit adds the same error handling we have in the DatabaseStore
and moves the code around so it's available both in the main and
renderer processes.

After this commit, if the database fails to open during main process
initialization, due to malformed errors or others, we will correctly
inform the user that the database is corrupted, rebuild it, and restart
the app.

Test Plan:
manually throw errors during setup, verify that we handle them
correctly

Reviewers: mark, spang, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4431
2017-04-17 10:30:15 -07:00
Juan Tejada 5b99c56310 [client-app] Remove dead mail rules code
Summary:
Which was arguably already a code smell being inside the
DatabaseStore

Test Plan: manual

Reviewers: mark, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4430
2017-04-17 10:17:34 -07:00
Juan Tejada 2c22d1aea2 [client-app] Update changelog 2017-04-14 13:37:01 -07:00
Juan Tejada f9a7a59bde [client-app] Update changelog 2017-04-14 13:36:31 -07:00
Nylas Coffee Machine 66b9bd1770 bump(version): 2.0.14 2017-04-14 12:25:57 -07:00
Juan Tejada 00aa499365 [client-sync] Prevent duplicate accounts and sync workers
Summary:
After https://github.com/nylas/nylas-mail-all/commit/008cb4c, the shape of
account.connectionSettings changed, which means that ids for accounts
will also change, given that they are based on the connection settings (see
Account.hash()).

This is fine in most cases, except for accounts that were running on a
version of Nylas Mail before 008cb4c, then upgraded to a version
after 008cb4c, and then re-authed their account.
In this scenario, re-authing the account will create a second account with
a different `id` but with the same email address, along with an extra
sequelize database, and will start a second SyncWorker for the same
account. App-side, the `AccountStore` will correctly overwrite the first account,
so users would correctly see just 1 account in the sidebar. However, given
that 2 SyncWorkers would be running for the same account,
message ids would collide in edgehill.db and this would cause
threads to disappear from the ui as if they were being deleted.

To fix this, we need to do 2 things:

- Upon app start, we remove any duplicate accounts that might have been created due to this bug before starting any sync workers
- If we detect that we are going to create a duplicate account upon auth success, we delete the old account first. This will effectively cause sync to restart for the account.

Test Plan:
Verified problem: Checked out a commit before 008cb4c, authed an account, checked out master, re-authed account, verified that duplicate accounts are created.

Then test 2 scenarios:
- With duplicate accounts present, checked out this commit, verified that duplicate account would be removed and sync would function normally.
- With an account authed on a build before 008cb4c, checked out this commit, re-authed the account, and verified that duplicate account wouldn't be created

Reviewers: mark, halla, khamidou, spang

Reviewed By: spang

Subscribers: tomasz

Differential Revision: https://phab.nylas.com/D4425
2017-04-14 12:24:27 -07:00
Juan Tejada 373eb9651b [client-sync] Correctly remove sync worker reference when destroying it
Summary:
By nullifying the key inside `workersByAccountId` we would attempt to
access accountIds that no longer existed in other parts of the code by
using Object.keys()

This makes it so we correctly completely remove the record from the map

Test Plan: manual

Reviewers: halla, spang, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4426
2017-04-14 11:18:23 -07:00
Juan Tejada c6f7a862c9 [client-sync] Init SyncProcessManager with Identity 2017-04-13 21:37:00 -07:00
Mark Hahnenberg b1123433d0 [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
2017-04-13 16:45:12 -07:00
Juan Tejada 91f5ca4de9 [client-app] Update changelog 2017-04-13 14:02:24 -07:00
Juan Tejada 9fbee22538 [client-app] Update changelog 2017-04-13 13:27:28 -07:00
Nylas Coffee Machine 1f307f66d8 bump(version): 2.0.13 2017-04-13 12:32:00 -07:00
Juan Tejada fc5583523e [client-app] Upload nupkg with correct name for win32 autoupdater to work
Summary: See title

Test Plan: manual

Reviewers: spang, khamidou, halla

Reviewed By: khamidou, halla

Differential Revision: https://phab.nylas.com/D4421
2017-04-13 12:29:29 -07:00
Juan Tejada 911d75b113 [client-app] Correctly handle window.unhandledrejection events
Summary:
It seems that sometimes we get events that don't have `event.detail.reason`.
This commits tries to make our best guess, or report info about the event shape

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4420
2017-04-13 11:54:27 -07:00
Juan Tejada aa7749dff5 [client-app] Update changelog 2017-04-13 11:25:50 -07:00
Nylas Coffee Machine 94dc4d0a30 bump(version): 2.0.12 2017-04-13 11:09:03 -07:00
Juan Tejada a7b1034dc6 [client-app] Prevent NM from overwriting N1 binary on windows
Summary:
This changes the `name` option we pass to `electron-windows-installer`,
which makes it so that the app is installed under
`AppData\Local\NylasMail` instead of `AppData\Local\Nylas` where the
old N1 binary lives

Test Plan: manually tested the builds from `ci-test-4` branch on the surface machine

Reviewers: mark, spang, khamidou, halla

Reviewed By: khamidou, halla

Differential Revision: https://phab.nylas.com/D4419
2017-04-13 11:07:16 -07:00
Juan Tejada d5a2afd0f6 [client-app] Fix runtime error in FetchFolderList
Summary: See title

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4418
2017-04-13 10:49:08 -07:00
Juan Tejada 9c889c7cff [client-app] Prevent old N1 config from getting wiped when installing Nylas Mail
Summary:
Due to a legacy migration system, users that had previously installed
old N1 (1.5.0) would get their N1 config wiped after installing Nylas
Mail (2.0) in most cases.

See https://github.com/nylas/nylas-mail/blob/n1-pro/src/browser/nylas-pro-migrator.es6 for details

Fixes T8096

Test Plan: manual

Reviewers: halla, spang, mark

Reviewed By: mark

Maniphest Tasks: T8096

Differential Revision: https://phab.nylas.com/D4417
2017-04-12 20:48:40 -07:00
Juan Tejada 664da98c22 [*] Remove useless docs
Summary:
This makes grepping the codebase really painful. We don't need these
docs here

Test Plan: manual

Reviewers: mark halla spang evan

Subscribers:
2017-04-12 19:58:06 -07:00
Juan Tejada e4dcfa40b1 [client-app] Update changelog 2017-04-12 13:12:24 -07:00
Nylas Coffee Machine 3396254499 bump(version): 2.0.11 2017-04-12 12:13:03 -07:00
Mark Hahnenberg 8d4ef160a1 [client-sync] Dispose of mail listener connection before getting new one
Summary:
When we had to refresh our credentials for the mail listener connection we
weren't disposing of the old connection which caused us to slowly leak
connections from the IMAP connection pool, eventually requiring a
restart. Now we always dispose of the connection prior to requesting a
new one from the pool.

Test Plan: Run locally always refreshing credentials, verify we don't get stuck

Reviewers: spang, evan, halla, juan

Reviewed By: halla, juan

Subscribers: halla

Differential Revision: https://phab.nylas.com/D4414
2017-04-12 12:11:49 -07:00
Juan Tejada 811843f880 Revert "[client-sync] Poll for gmail attribute changes from _mailListenerIMAPConn"
This reverts commit 15c3e328fc.

See https://phab.nylas.com/D4410 for details on why it was reverted
2017-04-12 12:08:24 -07:00
Juan Tejada 1bf453dd4a [client-app] Don't double report unhandled rejections
Summary:
We listen for unhandled rejections on both the `process` and the `window`. From
my understanding, both are necessary because some errors might escape
one or the other. However, most errors get caught by both handlers, so
we don't want to double report them to sentry (or the console).

To prevent this, this commit debounces the unhandled rejection handler
for a very short time so that the same error only gets reported once.
Additionally, it rate limits reports to sentry based on the stack trace

Test Plan: manual

Reviewers: mark, halla

Reviewed By: mark, halla

Differential Revision: https://phab.nylas.com/D4413
2017-04-12 12:06:22 -07:00
Juan Tejada b6771ea745 [client-app] Fix unhandled rejection handling (fix ipc parse error)
Summary:
Previously, we were listening for unhanlded rejections on both the
`window` and the `process`. However, the window handler didn't receive
an error as a parameter, but rather a window event. When trying to
report this event and sending it over IPC we would get an ipc parse
error.

This commit makes it so we correctly report the error instead of the
window event.

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4412
2017-04-12 12:05:07 -07:00
Juan Tejada d30559aa6e Revert "[client-sync] Transaction-ify processMessage"
Summary:
This reverts commit c808438ee9.

Adding an overarching transaction to `processMessage` is causing
database locked errors when processing deltas, specifically when trying
to write to the Transaction table, given that that write happens
asynchronously inside the execution of `processMessage`, but doesn't
have access to its transaction. See T8117

Given that the performance gains from wrapping messgae processing in a
transaction were not significant, let's revert this to prevent db
locking issues

Test Plan: manual

Reviewers: halla, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4411
2017-04-12 12:04:11 -07:00
Juan Tejada 8d9b247a95 [client-app] Rate limit database malformed error reports to sentry
Summary:
We were reporting 1m+ of these events, heavily contributing towards our
quota

Test Plan: manual

Reviewers: halla, mark

Reviewed By: halla, mark

Differential Revision: https://phab.nylas.com/D4406
2017-04-11 16:36:48 -07:00
Juan Tejada 58d2274faa [client-app] Update changelog 2017-04-11 15:41:30 -07:00
Nylas Coffee Machine 545f6a30da bump(version): 2.0.10 2017-04-11 13:34:47 -07:00
Juan Tejada 0525767518 [client-sync] Ensure allmail folder exists before trying to access it
Summary:
When checking for flag updates for gmail accounts, when syncing for the
first time the all mail folder won't be available because we haven't
fetched the folder list, so it will throw a runtime error

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4405
2017-04-11 12:36:39 -07:00
Halla Moore d226eaf4a7 [client-app] Fix SyncbackMetadataTask dependency
Summary:
Add a sequentialId check in isDependentOnTask() so that the first
SyncbackMetadataTask won't get blocked on other SyncbackMetadataTasks
in the queue for the same pluginId.

Addresses T8112

Test Plan: Manual

Reviewers: spang, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4404
2017-04-11 12:22:57 -07:00
Halla Moore 61594021ae [isomorphic-core] Add missing .default to require 2017-04-11 11:09:39 -07:00
Halla Moore 840ebebecf [isomorphic-core] Move buildMime to MessageUtils, add includeBcc option
Summary:
Since buildMime isn't always used explictly for the send operation (we
mostly use it for stuffing the sent folder, which is a separate
operation), move it to MessageUtils. Additionally, add an includeBcc
option. We don't want the BCC header to be visible on outbound messages,
but it needs to be present on the version that is saved to the sent
folder.

When we weren't including the BCC header in the sent folder version, we
were getting an id mismatch between our optimistic message and the
message that gets processed by the sync loop (because we include the bcc
participants when computing the id hash). When the sent message was a
reply, the optimistic message included the threadId, and this had the
side effect of leaving both versions of the sent message in the thread.
Since the optimistic message never receieved it's imap UID, any action
performed on the thread would fail with the missing UID error as seen in
T7941. Adding this BCC header will allow us to compute the proper id
hash and reconcile the synced message with the optimistic message.

Test Plan: manual

Reviewers: evan, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4365
2017-04-11 10:49:58 -07:00
Halla Moore 379edfe0b8 [*] MessageFactory -> MessageUtils, SendUtils -> ModelUtils
Summary: Rename some util files

Test Plan: manual

Reviewers: evan, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4364
2017-04-11 10:49:30 -07:00
Halla Moore f82c72aa88 [client-sync] Don't report stuck sync processes to Sentry
Summary: Just to mixpanel. Addresses T8095

Test Plan: Meh

Reviewers: mark, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4403
2017-04-11 10:45:09 -07:00
Juan Tejada f6f8f16e25 [client-app] Update changelog 2017-04-11 10:37:13 -07:00
Nylas Coffee Machine a412580cad bump(version): 2.0.9 2017-04-11 08:12:13 -07:00
Halla Moore 15c3e328fc [client-sync] Poll for gmail attribute changes from _mailListenerIMAPConn
Summary:
Normally, the imap connection emits an 'update' event when there are any
flag changes. Gmail, however, only emits the 'update' event when there
are new or removed messages. If there's a fairly large batch size being
synced in the sync loop, we don't want to wait until the end of that to
check if the highestmodseq has changed. To get around this, this diff
updates the new mail listener connection to periodically poll for the
highestmodseq and trigger the same update handler when changes are
detected.

Test Plan: manual

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4397
2017-04-10 15:46:02 -07:00
Halla Moore c6db6c3ae2 [client-app] Re-add imap to the onboarding accounts page
Summary:
Put the IMAP option back on the provider selection page within
onboarding. Also remove the 'hidden' property on account types since I
don't think we'll be using it for any other providers, and remove the
'Add Custom IMAP Account' from the application menu.

Addresses T8097

Test Plan: Manual

Reviewers: spang, mark, juan

Reviewed By: mark, juan

Differential Revision: https://phab.nylas.com/D4402
2017-04-10 15:44:26 -07:00
Juan Tejada 07d576d5f4 [client-app] Fix delta streaming connection retries
Summary:
Previously, every time our NylasLongConnection changed its status to
`connected`, we would reset our backoff scheduler, assuming that
every time our status changed to `connected` it meant that we would not
receive any errors.

However, if our backend is down or overloaded (or returning 401s like in
our recent outage), we would do the following:

1. Establish connection, change status to `connected`
2. Reset backoff scheduler
3. Receive error
4. Close connection
5. Schedule next retry using backoff scheduler. Delay will be 1s or less, because scheduler was reset in 2.
6. Retry after delay,
7. Repeat from 1., ad infinitum

This caused us to consistantly hammer our servers and render our
exponential backoff useless.

This commit makes it so we conly reset the backoff scheduler when we
actually receive deltas, and increments the max backoff to 10 minutes

Test Plan:
run against local n1Cloud, manually return 401s from the api, verify that we
didn't backoff at all before this diff, verify that we backoff correctly after
this diff

Reviewers: mark, spang, halla

Reviewed By: mark, spang, halla

Differential Revision: https://phab.nylas.com/D4401
2017-04-10 15:08:48 -07:00
Halla Moore e8957b787e [isomorphic-core] Handle weird MIME edge case with @ symbol
Summary:
Something weird happens with the mime building when the participant name
has an @ symbol in it (e.g. a name and email of hello@gmail.com turns
into 'hello@ <gmail.com hello@gmail.com>'), so replace it with
whitespace.

Test Plan: manual

Reviewers: evan, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4363
2017-04-10 12:40:22 -07:00
Mark Hahnenberg be4b0d773c [client-app] Add benchmark mode
Summary:
There are some settings that apply to dev and prod modes that we don't want
to use while benchmarking. E.g. the folder where we store messages,
whether we generate long stack traces in our bluebird promises, etc.
This diff adds a benchmark mode so that we can change these settings to
something that works better for benchmarking.

Test Plan: Run locally, verify it works

Reviewers: evan, juan, spang

Reviewed By: juan, spang

Differential Revision: https://phab.nylas.com/D4374
2017-04-07 15:33:57 -07:00