Commit graph

178 commits

Author SHA1 Message Date
Juan Tejada d53e0c4a7f [client-app] Correctly show auth error when we can't connect to n1cloud
Summary:
Previously, n1 cloud auth errors were stuffed into an account's
syncState. The problem with that is that the sync loop manages that
state, and as long as the sync loop is running it will set that state to
running. However, it might be the case that the sync loop is running but
we can't connect to n1Cloud, so even though we would set the `syncState`
to `n1_cloud_auth_failed`, the sync loop would just set it back to
'running', and the user wouldn't see the error notification indicating
that it can't connect to n1Cloud

This commit makes it so we keep tracj of the auth failure state for
n1Cloud in a separate field, and makes sure that the error notification
component shows that error.

Test Plan: manual

Reviewers: mark, spang, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4172
2017-03-10 15:56:41 -08:00
Juan Tejada 688f6343bc [client-app] Fix runtime error during send error handler
Summary:
On rare occasions, the api error would not have a body, and we would try
to access the message prop on the body, which would in turn throw an
error.

This commit prevents this error, and adds better messaging to the sentry
report

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4194
2017-03-10 15:31:29 -08:00
Juan Tejada 1864c6f5d4 [client-app] Update changelog 2017-03-10 14:38:42 -08:00
Juan Tejada aaccd0ec16 [client-app] Update changelog 2017-03-10 14:06:30 -08:00
Juan Tejada f467664bde [client-app] Measure and report inline composer open times + consolidate timers
Summary:
This commit adds a new perf metric for inline composer times.

Additionally, it consolidates the timer logic for all other types of draft
creation (mailto links, dropping a file in the app dock icon, etc).

Test Plan: manual

Reviewers: halla, evan, mark

Reviewed By: evan, mark

Differential Revision: https://phab.nylas.com/D4186
2017-03-10 14:02:02 -08:00
Mark Hahnenberg 811c192125 bump(version): 1.0.36 2017-03-10 13:41:54 -08:00
Juan Tejada 25ba62e02a [client-app] Update changelog 2017-03-10 13:33:03 -08:00
Nylas Coffee Machine 86e3cc027f bump(version): 1.0.35 2017-03-09 22:04:18 -08:00
Juan Tejada a8fe22551f [client-app] Make sure we retry delta connection when reauthing account
Summary: See title

Test Plan: manual

Reviewers: halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4176
2017-03-09 21:50:39 -08:00
Juan Tejada d2cd0db335 [client-app] Prevent delta streaming connection from retrying too much
Summary:
Before this commit, we would call .close() onError and when the
connection closed. We also closed the connection onError, even though
NylasLongConnection had also closed it, so we ended up calling close a
bunch of times. This would cause us to set a bunch of timeouts to retry
unecessarilly.

This commit makes it so we ensure there's only one retry timeout and
consolidates the logic that calls .close() so we don't call it so many
times unnecessarily

Test Plan: manual

Reviewers: spang, mark, evan

Reviewed By: mark, evan

Differential Revision: https://phab.nylas.com/D4166
2017-03-09 15:28:23 -08:00
Juan Tejada da463c250f [client-app] Consolidate delta connection stores, rm deltas internal_pkg
Summary:
This commit consolidates the `DeltaConnectionStatusStore` and the
`DeltaConnectionStore` which kept track of very similar state and made
sense to be the same store (as per feedback in D4118#77647)

Given that this state needs to be available app-wide for plugins to
query the status of delta connections, `internal_packages/deltas` was
removed (given that it only activated that store), in favor of having the
unified store inside `src/flux/stores` and available via `nylas-exports`

The `deltas` package also contained some contacts-ranking code, which is
no longer in use until we restore that fetaure, so I created a
`internal_packages/contact-rankings` which contains this unused code for
now.

Test Plan:
manually open, close, end delta connections, verify that I'm getting
correct results. unit tests to come

Reviewers: halla, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4145
2017-03-09 15:27:06 -08:00
Juan Tejada 7b9680fff4 [client-app] 🎨 Rename NylasSyncStatusStore to FolderSyncProgressStore
Summary: see title

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4141
2017-03-09 15:24:43 -08:00
Juan Tejada aaf4cb60b2 [client-app] Consolidate apierror status code that we should not report
Summary:
This DRY's up code that use these status codes

Depends on D4130

Test Plan: manual

Reviewers: spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4140
2017-03-09 15:24:06 -08:00
Juan Tejada 667e1d6691 [client-app] Fix error when attempting to report a fetch id error
Summary:
When reporting error inside `IdentityStore._fetchIdentity`, we would
pass null as the `extra` parameter for `reportError`. This would cause
us to try to assign something to null and throw an error while reporting
the error.

(Even though `extra` has a default value of `{}` (see
declaration of `NylasEnv.reportError`), passing null will be interpreted
as a valid arg and it wont get assigned the default value)

Thankfully, the second error /is/ reported to sentry: https://sentry.io/nylas/nylas-mail/issues/230589717/

Test Plan: manual

Reviewers: mark, halla, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4150
2017-03-09 15:22:34 -08:00
Christine Spang bb18f98b83 [client-app] Don't report incorrect username or password to Sentry
Summary:
This is not a bug. Maaaybe we want to report this to MixPanel for individual
user debugging (how do we do that?), but it doesn't make sense to report this
error to Sentry.

Example:

https://sentry.io/nylas/nylas-mail/issues/230530818/

Test Plan: yolo

Reviewers: mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4130
2017-03-09 12:26:34 -08:00
Evan Morikawa 3c8925ef76 [client-app] don't re-close dev tools
Summary:
If you have the console open and are looking at the Source panel or
something, this will constantly bring you back to the Console panel. Won't
do that anymore with this chec

Test Plan: manual

Reviewers: spang, mark, halla, juan

Reviewed By: mark, halla, juan

Differential Revision: https://phab.nylas.com/D4162
2017-03-09 15:14:16 -05:00
Evan Morikawa 3e895c74c9 [client-app] fix circular errors and logging
Summary:
Errors weren't getting reported because of a circular reference causing
JSON.stringify to fail.

We can't add the whole API `response` object onto the error object,
because sometimes (like when the delta connection errors with a 401), the
`response` object is circular. We only use it to the extract the status
code anyway and it's a huge object. This diff excludes them from the
APIError objects.

We also have code to recover just in case JSON.stringify errors for some
other weird reason. It'll still attempt to report the error prefixed with
`Recovered Error`

Finally, we used to spit only the `error.stack` to the console. This meant
what we saw in the console didn't properly include the error messages
being incredibly not useful.

It's better to console.error the whole error object since that'll more
nicely display on the inspector console

Test Plan: manual

Reviewers: juan, spang, mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4154
2017-03-09 15:11:36 -05:00
Mark Hahnenberg 47f57a6c02 [client-sync] Gracefully handle large amounts of unknown UIDs from search
Summary:
Previously if we got back a huge number of unknown UIDs from IMAP search
we would try to sync all of them at once. This could lead to hanging the sync
loop trying to download tons of messages. This diff limits the UIDs we're
willing to sync per task to 500 and splits each task up into chunks of 25
messages so that we don't try to download all of them at once. If we need
to sync more than 500 uids then at the end of the syncback task it will
queue another task to run the next time the sync loop rolls back around.

Test Plan:
Run locally, verify that we gracefully handle various situations
including cancelling during the syncback task, cancelling between syncback
tasks, huge numbers of results, etc

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4142
2017-03-09 11:47:18 -08:00
Juan Tejada cd21e6087d [client-app] Correctly set process title 2017-03-09 10:59:23 -08:00
Juan Tejada d92969efc3 [client-app] Update changelog 2017-03-09 09:53:30 -08:00
Juan Tejada f6791925c5 [client-app] Update changelog 2017-03-09 08:22:28 -08:00
Juan Tejada 0f2896446e [client-sync] Bump sequelize version - Ensure it doesn't halt sync
Summary:
This commit bumps the version of sequelize to point to the latest
version in our fork. This version bump also includes latest updates from
upstream sequelize since the last time we bumped the version.

Notably, it includes a critical fix that will prevent the sync
loop from getting stuck on rare occasions.

Specifically, sequelize's `Query.prototype.run` could in some cases return a
Promise that would /never/ resolve or reject, effectively halting the
execution of any code that was waiting for that promise. This was due to
a lack of error handling inside a the query's `afterExecute` function; if an
error was thrown there, the enclosing Promise would never reject, and
the error would just remain uncaught. An example of such an error that
could cause this scenario is: T7742 - https://sentry.io/nylas/nylas-mail/issues/230016155/

Sync getting halted in this way can produce a variety of user facing
bugs like not being able to send or it taking an absurd amount of time
(hours), tasks never finishing or taking an absurd amount of time to
complete, new mail not arriving, among others

The commit that fixes this is: 0deeda9e1a
The full set of changes introduced by this version bump are: https://github.com/nylas/sequelize/compare/nylas-3.30.0...nylas-3.40.0

**Note:**
It is important to note that sequelize might still halt the sync loop if
there are other places in the code that can return Promises that never
resolve or reject under certain circumstances. I can consistently reproduce this
scenario when an error is thrown inside `afterExecute`, and I've seen it
happen in the wild, but I've also ran into this type of sync loop halting (db
promises never resolve) without any sequelize errors being thrown, which
suggests that there are other places in the sequelize code that might end
up returning a Promise that will halt sync.

Unfortunately, we don't have a good way to detect and report when this
happens yet, but we are adding one in upcoming diffs in order have data
on how many people are running into this, and/or if this patch completely
fixes the issue. Otherwise, we'd need to audit sequelize's code.

Should resolve T7837 and T7767

Test Plan: manual

Reviewers: spang, mark, halla, khamidou, evan

Reviewed By: evan

Subscribers: mg, tomasz

Maniphest Tasks: T7767, T7837

Differential Revision: https://phab.nylas.com/D4152
2017-03-09 08:20:49 -08:00
Juan Tejada d95ee3aba1 bump(version): 1.0.34 2017-03-08 22:28:39 -08:00
Juan Tejada 12cbd383bf [client-app] (deltas P6) Split local and cloud deltas
Summary:
This commit splits apart the `AccountDeltaConnection` class, which was
in charge of listening to both cloud /and/ local deltas by way of an
artificial interface, `DeltaStreamingInMemoryConnection`.

Splitting this into 2 modules with separate responsibilities will hopefully
make this code easier to reason about and reduce some cruft and unnecessary
indirection.

Specifically, this commit makes it so:

- `DeltaConnectionManager` is only in charge of starting and ending `DeltaStreamingConnection`s, which are solely in charge of listening to deltas from the cloud api
- `LocalSyncDeltaEmitter` no longer unnecessarily emits events for the `deltas` package to listen to but rather directly processes and saves those deltas from the K2 db to edgehill.db
- `LocalSyncDeltaEmitter` is also in charge of keeping track of the latest received cursor, under its own JSONBlob key in edgehill.db. This migrates localSync cursors saved under the old key.
- `LocalSyncDeltaEmitter` is now instantiated and managed from within the `SyncProcessManager` as opposed to the `SyncWorker`. Apart from removing extra state from the `SyncWorker`, this removes dependencies on the client-app environment from the sync-worker.
- `DeltaStreamingInMemoryConnection` and `AccountDeltaConnection` are now gone

(Sorry for the big diff! This one was a little hard to split up without landing something broken)

Depends on D4121

Test Plan: manual + unit tests planned in upcoming diff

Reviewers: halla, mark, evan, spang

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4122
2017-03-08 12:12:50 -08:00
Juan Tejada 52b04bcb39 [client-app] (deltas P5) Move DeltaProcessor to nylas-exports
Summary:
This is to make it available to all plugins in the app
Depends on D4120

Test Plan: manual

Reviewers: halla, mark, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4121
2017-03-08 12:09:31 -08:00
Juan Tejada 321c583d60 [client-app] (deltas P4) Fixup DeltaStramingConnection + retry on close
Summary:
This commit completely refactors `DeltaStreamingConnection`, notably
introducing the following changes:

- Right now, `AccountDeltaConnection` establishes both delta connections to the cloud api and to the `client-sync` database (K2). This class is meant to disapper in favor of splitting into two different classes meant for syncing with the n1Cloud api and the local database. Specifically, `DeltaStreamingConnection`'s only responsibility is now to connect to the n1Cloud API and establish an http streaming connection for metadata deltas, etc. This class no longer unecessarily inherits from `NylasLongConnection`, which removes a lot of unecessary callback indirection.
- The statuses of the n1Cloud delta streaming connections are now stored in as JSONBlobs in edgehill.db under new keys. This commit ensures that the data is correctly migrated from the old key (`NylasSyncWorker:<account_id>`).
- The `DeltaStreamingConnection` now correctly retries when closed or errors. This logic previously existed, but was removed during the K2 transition: https://github.com/nylas/nylas-mail/blob/n1-pro/internal_packages/worker-sync/lib/nylas-sync-worker.coffee#L67
- Delta connection retries now backoff using the `ExponentialBackoffScheduler`
- Attempt to restore the delta connection whenever the app comes back online

Depends on D4119

Test Plan: manual + planned unit tests in upcoming diff

Reviewers: halla, mark, evan, spang

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4120
2017-03-08 12:08:41 -08:00
Juan Tejada 54f918c862 [client-app] (deltas P3) Change onResults interface in NylasLongConnection
Summary:
For legacy reasons, NylasLongConnection did not take the `onResults`
callback as an option, but rather it was a method you had to call on the
connection, which took the callback, and which you had to call after
instantiating the connection. This was an annoying and clunky interface.

This commit makes it so NylasLongConnection takes an `onResults` option
as one would expect it to, and updates any references to the old
interface

Depends on D4118

Test Plan: manual

Reviewers: halla, mark, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4119
2017-03-08 12:02:08 -08:00
Juan Tejada 47b311ce0c [client-app] (deltas P2) 🎨 Split up NylasSyncStatusStore
Summary:
Turns out, NylasSyncStatusStore doesn't need to concern itself with the
status of delta connections.

This is legacy cruft from the days when this store used to provide the
online status of the app based on the delta connections. Now we have an
OnlineStatusStore, so we don't need this at all

Instead of stuffing that state in that store, this commit adds a small
DeltaConnectionStatusStore to provide an easy way to listen to changes
on the status of delta connections. The only part of the app concerned
with that state is the DeveloperBarStore in order to render the green
circles for delta connections in the worker window.

Depends on D4117

Test Plan: manual

Reviewers: mark, halla, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4118
2017-03-08 12:00:07 -08:00
Juan Tejada a6aa37c448 [client-app] (deltas P1) 🎨 Fixup AccountDeltaConnectionPool
Summary:
- Rename to `DeltaConnectionManager`
- Convert main.coffee to main.es6
- Use async/await

Test Plan: manual

Reviewers: halla, mark, evan, spang

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4117
2017-03-08 11:58:25 -08:00
Juan Tejada 4fd1f3e97d bump(version) 1.0.33 2017-03-07 23:06:28 -08:00
Christine Spang 49c6a8cdcd [client-app] Differentiate APIError by URL also
Summary:
We have a bunch of different endpoints and it'd be helpful to know which
endpoints are failing, not just which status codes are being thrown. e.g. while
trying to reproduce send failures, I've been able to cause /auth to fail with a
504, but I couldn't tell which endpoint was failing with the 504 until I added
this extra differentiator.

Test Plan: manual

Reviewers: mark, juan

Reviewed By: mark, juan

Differential Revision: https://phab.nylas.com/D4128
2017-03-07 18:41:26 -08:00
Christine Spang 9bdf8ae763 [client-app,cloud-{api,workers}] Bump raven version
Sentry is complaining that we're sending events using an old SDK.
2017-03-07 17:41:33 -08:00
Mark Hahnenberg f68b999687 [env] Don't generate sourceMapCache in prod mode
Summary:
Keeping a sourceMapCache uses a great deal of memory. Don't do it if we
don't have to.

Test Plan: Run locally, verify that we no longer generate a sourceMapCache

Reviewers: evan, juan, spang

Reviewed By: evan, juan, spang

Differential Revision: https://phab.nylas.com/D3964
2017-03-07 12:00:35 -08:00
Evan Morikawa 5024f9c2cc [client-app] also upload a next-version to S3 for autoupdate testing
Summary:
We never want to ship the last release we'll ever ship.
This can happen if the new version's autoupdater is broken.
To test this we upload to a version n+1 higher than the current one.

Test Plan: manual

Reviewers: juan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4125
2017-03-07 14:54:50 -05:00
Mark Hahnenberg 280a5ba6e2 [client-sync] Fetch unknown search results
Summary:
When searching using IMAP/Gmail commands we sometimes get back UIDs for
messages that we have yet to sync. Previously we would just ignore these
results, which would decrease the quality search results for quite some
time during initial sync. This diff enables us to eagerly sync the unknown
messages we get back from the provider by creating a syncback task which
interrupts the sync loop and runs a sync task for the unknown UIDs.

Test Plan: Run locally, verify that we sync unknown messages

Reviewers: spang, evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4101
2017-03-07 11:30:58 -08:00
Juan Tejada 4b45f9f308 [client-app] Update changelog 2017-03-07 01:42:13 -08:00
Juan Tejada 4275e4c6ed bump(version) 1.0.32 2017-03-07 00:45:45 -08:00
Juan Tejada a5ace0c5cb [client-app] 🎨 DRY a few lines of code 2017-03-06 12:59:09 -08:00
Juan Tejada bc9304ad40 [client-app] Report provider when reporting remove-from-threads-from-list
Summary: see title

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4103
2017-03-06 12:51:38 -08:00
Juan Tejada 1ff3f0f596 [client-app] Report provider when reporting send perf metrics
Summary: see title

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4102
2017-03-06 12:50:57 -08:00
Juan Tejada 3bbb76902f [client-app] Add basic rate limiting to Sentry
Summary:
This commit adds a new option to the `reportError` interface to allow
to rate limit specific kinds of errors that are known to be reported a
lot if they fall in a loop for example.

For now, it only allows to impose a fixed reporting rate per hour for a specific
error, and will not report any errors past that rate before an hour has
passed.

Depends on D4099

Test Plan:
manually check that it reports and does not report errors based on the rate
limit data passed

Reviewers: khamidou, mark, evan, halla, spang

Reviewed By: evan, halla, spang

Differential Revision: https://phab.nylas.com/D4100
2017-03-06 10:56:20 -08:00
Juan Tejada a041b79aaa [client-sync] Don't double report refresh access token API errors
Summary:
Given that NylasAPIRequest reports all APIErrors for requests that
return 5xx, we were double reporting access token errors, which caused 2
groups in sentry and makes it difficult to track.

This commit removes the extra reporting for that error in the sync loop

Test Plan: manual

Reviewers: evan, khamidou, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4098
2017-03-06 09:54:51 -08:00
Evan Morikawa d53b39f344 [client-app] resolve symlinks in spec 2017-03-06 09:42:59 -05:00
Juan Tejada 9a01aa7bcb [client-app] Prevent noisy uncaught errors when closing long connection
Summary:
This commit makes it so we /always/ catch errors thrown in the request
established inside `NylasLongConnection`. Specifically, it catches an
uncaught `socket hang up` error which is flooding Sentry unnecessarily
(https://sentry.io/nylas/nylas-mail-old-1030/issues/213178758/).

This error is thrown when the long connection is manually ended before
any data was received from the request (which happens most times during
search when you clear the search query).

The problem was that when we end the long connection, we remove all event listeners
from the request, and /then/ the error is thrown, at which point there is no error
handler to catch it. The solution is simply to always have an error handler attached to
the request object.

This commit also adds extra error handling that seems to have been missing.

Test Plan:
manually check that delta connection is still working, and that error
is no longer thrown when you search and then immediately clear the search

Reviewers: mark, evan, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4096
2017-03-05 23:14:49 -08:00
Juan Tejada 93234d5997 [client-app] Correctly listen and report abort and aborted events in NylasAPIRequest
Summary:
We want to listen to both `abort` and `aborted`

- `abort` happens when we manually abort a request client side, so we don't want to report this to sentry
- `aborted` happens when the server aborts the request, so we /do/ want to report in this case

Test Plan: manual

Reviewers: spang, mark, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4073
2017-03-05 23:13:44 -08:00
Evan Morikawa 8e355ba476 [client-app] fix hardcoded babelrc path for appveyor 2017-03-03 14:28:59 -08:00
Evan Morikawa 3eb05713df [client-app] update appveyor
Summary:
This updates the appveyor file to get the app building on windows too!

See https://ci.appveyor.com/project/nylas/nylas-mail-all

Test Plan: Run https://ci.appveyor.com/project/nylas/nylas-mail-all

Reviewers: juan, spang, jerm

Differential Revision: https://phab.nylas.com/D4000
2017-03-03 14:22:38 -08:00
Evan Morikawa 42a0fa033e [client-app] fix keychain issue on OSX build 2017-03-02 17:56:09 -08:00
Mark Hahnenberg 9ec7b57f9a [client-app] Add proper IMAP search backend
Summary:
Previously for IMAP we just grabbed the search text and fed it into a TEXT
query. Now we have a proper backend that generates the appropriate
search criteria according to the IMAP spec. Important to note that we
don't support 'in:' yet, which is complicated due to the way that IMAP
search is scoped to the currently selected folder.

Test Plan: Run tests, run locally and verify IMAP search still works.

Reviewers: evan, juan, spang

Reviewed By: juan, spang

Differential Revision: https://phab.nylas.com/D4071
2017-03-02 14:50:35 -08:00
Juan Tejada 04fab196f2 bump(version) 1.0.31 2017-03-02 12:10:50 -08:00
Halla Moore be805f7b5a [client-app, client-private-plugins] Update the pending send-reminders UI
Summary:
- Add an icon to threads that have reminders set
- Show the pending reminder message header in all perspectives, rather than
    just the Reminders perspective
- Add the ability to clear the reminder from the message header
- Condense the message header text

Test Plan: manual

Reviewers: evan, juan

Reviewed By: evan, juan

Subscribers: sdw

Differential Revision: https://phab.nylas.com/D4052
2017-03-02 09:52:30 -08:00
Juan Tejada 1f45c58aad [client-app] Report 100% of search performed events
Summary:
Gleb mentioned that we need the sample size of search events to be
bigger, so let's report all search events

Test Plan: manual

Reviewers: evan, gleb, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4077
2017-03-01 14:56:25 -08:00
Juan Tejada 6cc8d0c997 [client-app] Correctly import nylas-api-helpers 2017-03-01 14:06:00 -08:00
Evan Morikawa 53465515b0 [client-app] replace setImmediate with setTimeout as Promise scheduler
Summary:
This changes the scheduler from `setImmediate` to `setTimeout`. The HUGE
difference is that Chrome's async stack traces works with `setTimeout` but
does NOT work with `setImmediate`. These two functions are adjacent to
each other in the Node event loop, so nothing should depend on the change
in ordering.

Test Plan: manual

Reviewers: mark, spang, halla, juan

Reviewed By: spang, halla

Differential Revision: https://phab.nylas.com/D4068
2017-03-01 12:16:54 -08:00
Evan Morikawa 4de32d2828 [client-app] use new Bluebird preferred longStackTraces syntax
Summary: Bluebird changed the way you call `longStackTraces`. This uses the latest

Test Plan: manual

Reviewers: spang, halla, juan

Reviewed By: spang, halla

Differential Revision: https://phab.nylas.com/D4067
2017-03-01 12:15:46 -08:00
Evan Morikawa 756c80a7ce [client-app] remove unused async message body loading & returnsModel
Summary:
We no longer optimistically fetch messages when we load their bodies. We
always get the full message with bodies returned via the in memory delta
stream

Test Plan: manual

Reviewers: spang, halla, juan

Reviewed By: spang, halla, juan

Differential Revision: https://phab.nylas.com/D4066
2017-03-01 12:15:18 -08:00
Evan Morikawa ba1f429928 [client-app] deprecate returnsModel param for nylas-api-request
Summary:
We no longer need to use the `returnsModel` param since we get all of our
models through the in memory delta stream. There were a ton of places
unnecessarily passing `returnsModel: false` when it defaults to false in
the first place

Depends on D4057

Test Plan: manual

Reviewers: halla, spang, juan

Reviewed By: spang, juan

Differential Revision: https://phab.nylas.com/D4065
2017-03-01 12:13:08 -08:00
Evan Morikawa abaf63202c [client-app] deprecate ensureOnce for NylasAPI requests
Summary:
We no longer use the `ensureOnce` bit.

Depends on D4057

Test Plan: manual

Reviewers: spang, halla, juan

Reviewed By: halla, juan

Differential Revision: https://phab.nylas.com/D4064
2017-03-01 12:12:28 -08:00
Evan Morikawa 65ae74d21e [client-app] deprecate beforeProcessing in nylas-api-request
Summary:
This removes the last reference to a now unused `beforeProcessing` feature
of the Nylas API Request.

Depends on D4057

Test Plan: manual

Reviewers: spang, halla, juan

Reviewed By: halla, juan

Differential Revision: https://phab.nylas.com/D4063
2017-03-01 12:11:59 -08:00
Evan Morikawa fb94ff32f7 [client-app] have account store handle API auth errors
Summary:
The old  NylasAPIRequest helper class used to do all sorts of run-time
requiring to attempt to notify of auth errors when 401s and 403s came up
in a request. We now move that logic to the AccountStore where it belongs.

Depends on D4057

Test Plan: Manual

Reviewers: spang, halla, juan

Reviewed By: halla, juan

Differential Revision: https://phab.nylas.com/D4060
2017-03-01 12:11:13 -08:00
Evan Morikawa 787e13a0d2 [client-app] refactor nylas-api-request
Summary:
This greatly refactors the NylasAPIRequest object to be more single
purpose, easier to read, async-ified.

It also fixes issues where long stack traces weren't being reported bcause
`reportError` was being called before the error had time to make it
through Bluebird's rejection handler (which adds back in the long stack
traces).

This also fixes an issue where ignorable errors (like 404s,
ESOCKETTIMEDOUT) were being reporting to Sentry.

This also fixes subtle conditions where the request run would throw mixed
error types (sometimes regular `Error`s, sometimes `APIError`s).

The old class used to handle logging people out on 401s. This is now moved
to the AccountStore in a different diff.

We've also deprecated the `returnsModel` param in a separate diff.

This deprecates the `PriorityUICoordinator` since we no longer need to
worry about frequently making expensive API requests to pull down data
like we used to in the old cloud-based API.

This deprecates `ensureOnce` param in a separate diff.

Test Plan:
Manually boot app. Check regular 404s don't throw. Check requests get
through. Check special ESOCKETTIMEDOUT type errors are properly handled

Reviewers: juan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4057
2017-03-01 12:10:38 -08:00
Mark Hahnenberg 2d2621d2f3 [client-app] Refactor search query codegen into proper backend
Summary:
Previously we were using the raw visitors that were confined to the flux
attributes directory. We're going to add more search query backends, so this
is mostly just moving things to a new, more general place.

Test Plan:
Run locally, verify parser specs still work, verify in-app search
still works.

Reviewers: spang, evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4053
2017-03-01 11:53:03 -08:00
Juan Tejada b6a1fc5234 [client-app] Fix measurement of thread-list action metrics
Summary:
We detect when a thread is removed from the thread-list by listening to
`Actions.threadListDidUpdate`. However, we were not firing the action at
the correct moment.

Before this commit, we fired the action on the root `ThreadList`'s
`componentDidUpdate`, however did this not actually fire when the
child list actually updated/removed threads from the list.

This sort of used to work because before 396a027bcb
the root ThreadList component re-rendered all the time, so it fired the
action, but after initial sync, we would never actually report any
thread-list action metrics at all

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4051
2017-02-28 14:07:52 -08:00
Juan Tejada d3381b7446 [client-app] Update changelog 2017-02-28 13:19:34 -08:00
Christine Spang 26d247bd97 [client-app] Actually fix send+archive
The previous fix only worked by coincidence. It turns out that we don't have
the right data to associate draftClientId with ChangeMailTask on task
creation, so we have to either look up this data inside the dependency
function or make the dependency check looser.

This check gets run all the time, so we chose to make the check looser
rather than putting a db call in here and changing the interface to support
an async version of isDependentOnTask().

This patch also makes it so that the fix works properly when Undo Send
is enabled.

Fixes T7889
2017-02-28 12:38:14 -08:00
Christine Spang 1d90f7f770 [client-app] Fix ChangeMailTask dependency on SendDraftTask
Because ChangeMailTask only depended on EnsureMessageInSentFolder task,
if a user sent a message & then archived it before the send completed,
the ChangeMailTask could run in between the SendDraftTask and
EnsureMessageInSentFolderTask and fail because it's
EnsureMessageInSentFolderTask that detects the new UID for the message.

Fixes T7889
2017-02-28 12:12:39 -08:00
Juan Tejada 3f726d4d0b [client-app] Update changelog 2017-02-28 12:12:10 -08:00
Juan Tejada 19d504524b bump(version) 1.0.30 2017-02-28 11:48:28 -08:00
Juan Tejada de0e30d8dd Revert "[client-app] Limit search to focused perspective"
Temporarily reverting this commit for 1.0.30 release.
See https://phab.nylas.com/T7910 for details
This reverts commit da6bc473f8.
2017-02-28 11:07:44 -08:00
Juan Tejada 0294db95cf Revert "[client-app] Properly re-index threads when their data has changed"
Temporarily reverting this commit for 1.0.30 release because it is causing
performance issues: https://phab.nylas.com/T7910

This reverts commit 5e35d39eb2.
2017-02-28 10:35:58 -08:00
Juan Tejada 5714a23501 [client-app] Remove contact support btn from red box
Summary: See title

Test Plan: manual

Reviewers: evan, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4049
2017-02-28 10:27:58 -08:00
Juan Tejada 396a027bcb [client-app] Prevent unnecessary re-rendering of thread-list
Summary:
This commit adds a `shouldComponentUpdate` to thread-list.cjsx so that
the thread list doesn't unnecessarily /try/ to re-render when state or
props haven't actually changed.

I noticed this because the thread list was constantly calling `render`
even though it didn't render any changes to the DOM. This was caused
because it listens to `NylasSyncStatusStore` which constantly triggers,
even though the piece of state the list is interested in rarely changes,
causing unnecessary calls to the `render` loop.

Test Plan: manual

Reviewers: halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4047
2017-02-28 10:04:31 -08:00
Juan Tejada 72613baf5d [client-app] Fix selecting and creating signatures in preferences
Summary:
This commit fixes 2 issues with signatures in the preferences:
- Creating a signature (via any of the create buttons) would create 2 signatures
- Trying to select accounts to associate with a signature in the preferences would not work (the account would not be selected)

This was a regression introduced in e638e94084 (diff-4f38fd25aa24b48a309354be643165d3R26)

3111c16 made it so we attempt to `activate` any Stores that are registered with
the StoreRegistry. When adding stores to `nylas-exports`, they are
automatically registered in the StoreRegistry. Given that the
`SignatureStore` is in `nylas-exports`, and consequently is registered in
the StoreRegistry, it would be `activate`d upon window boot.

However, we were also manually activating it inside `internal_packages/composer-signatures/lib/main.es6`.
This caused it to register listeners for every action **twice**. For
this reason, 2 signatures would be created when trying to create 1, and
an account would be immediately unselected after being selected int he
signatures dropdown in preferences.

(Other changes in this are just stylistic)

Test Plan: manual

Reviewers: spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4043
2017-02-28 09:14:28 -08:00
Juan Tejada 5e35d39eb2 [client-app] Properly re-index threads when their data has changed
Summary:
When we detect that threads in the database have changed, if they've already
been indexed, mark them as unindexed so that the indexer picks them up and
re-indexes them with the updated data

Test Plan: manual

Reviewers: evan, spang, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4023
2017-02-23 17:52:09 -08:00
Juan Tejada e6b35497b8 [client-app] When reporting search metrics, clip all times to a range
Summary:
When reporting different times to mixpanel other than `actionTimeMs` via
recordPerfMetric, we also want to clip those times to a range to have
good data in mixpanel

This commit adds an extra option to recordPerfMetrics to be able to clip
data other than the default `actionTimeMs`, and uses the new option to
report search metrics

Test Plan: manual

Reviewers: spang, evan, halla, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4038
2017-02-23 17:42:27 -08:00
Juan Tejada f1ed46d144 [client-app] Sample metrics reporting of actions we're keeping track of
Summary:
I'm making these up based on gut feeling, so feel free to completely change
these.

Test Plan: manual

Reviewers: spang, mark, evan

Reviewed By: mark, evan

Differential Revision: https://phab.nylas.com/D4026
2017-02-23 17:40:22 -08:00
Juan Tejada 49586e2e06 [client-app] Fix passing in nylasId and accountId to report metrics
Summary: This was really broken

Test Plan: manual

Reviewers: halla, mark, evan

Reviewed By: mark, evan

Differential Revision: https://phab.nylas.com/D4021
2017-02-23 16:35:33 -08:00
Juan Tejada ad1a192b53 [client-app] Report source when reporting open times for accts window
Summary: See title

Test Plan: manual

Reviewers: mark, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4020
2017-02-23 16:17:50 -08:00
Juan Tejada aeddc92e8e [client-app] Measure and report search perf metrics
Summary: See title

Test Plan: manual

Reviewers: evan, spang, halla, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4019
2017-02-23 16:02:22 -08:00
Juan Tejada 7cd5128db4 [client-app] Measure and report app boot time
Summary: See title

Test Plan: manual

Reviewers: spang, mark, evan, halla

Reviewed By: mark, evan, halla

Differential Revision: https://phab.nylas.com/D4018
2017-02-23 16:01:07 -08:00
Mark Hahnenberg da6bc473f8 [client-app] Limit search to focused perspective
Summary:
Previously we would always search all mail. Now, if the user has focused
a particular folder we will limit our search to that folder. The inbox
is an exception--it will always search all mail unless the user
explicitly uses an "in:" clause.

Test Plan: Run locally, verify that searching folders returns the correct results.

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4032
2017-02-23 13:36:45 -08:00
Juan Tejada 18bf86769d [client-app] Update changelog 2017-02-23 10:52:14 -08:00
Juan Tejada feda238d9c [client-app] Measure and record times for opening account windows
Summary: See title

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4017
2017-02-22 17:09:42 -08:00
Juan Tejada ecf3709669 [client-app] Measure and report composer window open times
Summary: To Mixpanel and Honeycomb.

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4016
2017-02-22 17:08:31 -08:00
Juan Tejada b819889b36 [client-app] Measure and report task performLocal times
Summary: See title

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4015
2017-02-22 16:47:15 -08:00
Juan Tejada ae9aede300 [client-app] Measure and report sending times
Summary: See title

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4014
2017-02-22 16:45:08 -08:00
Juan Tejada 4c57fcfab4 [client-app] Measure and report time to select and load a thread
Summary: See title

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4013
2017-02-22 16:39:34 -08:00
Juan Tejada c4ec2d6bb7 [client-app] Report thread-list action perf metrics to Mixpanel
Summary: See title

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4011
2017-02-22 16:37:30 -08:00
Juan Tejada aa0bde0c41 [client-app] Add Actions.recordPerfMetric
Summary:
This action will report perf metrics to honeycomb /and/ mixpanel. This
commit also fixes up Analytics Store a little bit

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: halla, evan

Subscribers: jerm

Differential Revision: https://phab.nylas.com/D4012
2017-02-22 16:35:38 -08:00
Evan Morikawa 7b7318b220 [client-app] update Travis
Summary:
Also see:
3a33b0ad64
which was hot-pushed to master in order to get Travis building.

We now have two travis files:

1. /.travis.yml
2. /packages/client-app/travis.yml

The first one is alwas in the private repo and runs `npm install && npm
run build-client`. This decrypts our keys and signs, builds, and uploads
to S3.

The second one is designed to live in our yet-to-be public mirror. It will
basically just run `npm install && npm test`.

That way the public one should just about ALWAYS pass (YAY!) except of
course when you break the tests or something in the installer!

Test Plan: Run on new https://travis-ci.com/nylas/nylas-mail-all

Reviewers: jerm, spang, juan

Reviewed By: spang, juan

Differential Revision: https://phab.nylas.com/D3999
2017-02-22 16:19:45 -05:00
Juan Tejada c24c5bc341 [client-app] Update changelog 2017-02-21 17:44:23 -08:00
Mark Hahnenberg 7b55691cee [client-app] Don't compute thread search index size on startup
Summary:
We did this to see if we should clear the index, which no longer makes
sense because the index never exceeds our threshold. Additionally, none
of the other search indexes do this. This was causing us to spend a ton
of time scanning the ThreadSearch table at startup.

Test Plan: Run locally, make sure things are fine

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4007
2017-02-21 16:39:51 -08:00
Evan Morikawa 3a33b0ad64 [client-app] update build system 2017-02-21 17:32:22 -05:00
Juan Tejada 66873e3f9e bump(version) 1.0.29 2017-02-21 13:12:09 -08:00
Evan Morikawa 3071856a8e [client-app] symlink in babelrc and resolve links
Summary:
The prod build was failing because it couldn't find the .babelrc.

I decided to put the babelrc in the main nylas-mail repo with the
expectation that it'll need to be in the open source version too. To DRY
up this for us building, we sylink the root one to the client-app babelrc

Also since we now dereference symlinks we don't need to do the full copy
of nylas-private-resources so we don't have two error reporters floating
around

Test Plan: npm run build-client

Reviewers: juan, spang

Reviewed By: juan, spang

Differential Revision: https://phab.nylas.com/D3993
2017-02-21 16:08:59 -05:00
Christine Spang 776cf26d7a [client-app] Convert nylas-env.coffee to ES6 😓
Test Plan: unit tests + run the app

Reviewers: juan, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3979
2017-02-21 12:38:36 -08:00
Juan Tejada 15bcf974d2 [client-app] For consistency, proxy marking unread thru ThreadListActionStore
Summary: Depends on D3990

Test Plan: manual

Reviewers: spang, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3992
2017-02-21 12:31:07 -08:00
Juan Tejada 20f7ae47ca [client-app] For consistency, proxy starring thru ThreadListActionStore
Summary: See title

Test Plan: Depends on D3990

Reviewers: spang, halla, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3991
2017-02-21 12:29:52 -08:00
Juan Tejada 19195e9686 [client-app] Measure and report times for trashing and marking as spam
Summary:
See title

Depends on D3989

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: spang, halla

Differential Revision: https://phab.nylas.com/D3990
2017-02-21 12:26:58 -08:00
Juan Tejada 6dbbf1e094 [client-app] Measure and report times for removing labels from threads
Summary:
This commit adds new actions, `applyCategoryToThreads` and `removeCategoryFromThreads`
to be proxied and measured through the ThreadListActionsStore. These are called when
labels are added or removed via the category picker or by removing using
the label icon.

For now, we are only interested in timing actions that remove threads
from the inbox.

Test Plan: manual + reenabled unit tests for category-picker

Reviewers: spang, evan, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3989
2017-02-21 12:13:17 -08:00