Commit graph

5652 commits

Author SHA1 Message Date
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
Karim Hamidou b1ba489065 Revert "Revert "[feat] Add support for send later""
Arc land messed up and landed a not fully merged branch. (Seriously – I
had merged a copy of my branch with master to see how easy it would be.
Because I didn't want to merge the whole thing, I blindly committed my
changes and switched back to my real branch). To my great surprise, arc
decided to use the wrong branch when landing it.

Original commit message:

Summary:
    Finally, here it is! Send later, with support for open tracking but
without support for attachments yet. It took me some time to find the
right way to do things.

    **The send later dilemna**

    There's two ways we could handle send later:
    1. do everything on the client
    2. process the message in the cloud

    1. is very tempting because it would make the cloud server very
simple. Unfortunately, it has some serious limitations, for example,
setting the "Date" message header. That's why I chose to go with 2. When
a user presses the "Send Later" button, we save the open/link tracking
metadata and fills in all the required fields. I added a custom endpoint
to the K2 API to do this, `/drafts/build`. After that, we save the JSON
contents of the message as metadata.

    When we process metadata, we simply create a MIME message from the
JSON and send it.

    **Limitations**

    Right now, send later doesn't support and attachments. There's also
some minor code duplication which needs to be refactored away.

Test Plan: Tested manually. Checked that regular send still worked, too.

Reviewers: mark, spang, halla, juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4054
2017-03-07 17:21:29 -08:00
Karim Hamidou 2f67d8ac8b Revert "[feat] Add support for send later"
This reverts commit 683a550d49.
2017-03-07 16:18:25 -08:00
Karim Hamidou 683a550d49 [feat] Add support for send later
Summary:
Finally, here it is! Send later, with support for open tracking but without support for attachments yet. It took me some time to find the right way to do things.

**The send later dilemna**

There's two ways we could handle send later:
1. do everything on the client
2. process the message in the cloud

1. is very tempting because it would make the cloud server very simple. Unfortunately, it has some serious limitations, for example, setting the "Date" message header. That's why I chose to go with 2. When a user presses the "Send Later" button, we save the open/link tracking metadata and fills in all the required fields. I added a custom endpoint to the K2 API to do this, `/drafts/build`. After that, we save the JSON contents of the message as metadata.

When we process metadata, we simply create a MIME message from the JSON and send it.

**Limitations**

Right now, send later doesn't support and attachments. There's also some minor code duplication which needs to be refactored away.

Test Plan: Tested manually. Checked that regular send still worked, too.

Reviewers: mark, spang, halla, juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4054
2017-03-07 16:06:30 -08:00
Juan Tejada 14ca01af31 [client-app] 🎨 rename for consistency 2017-03-07 15:15:52 -08:00
Juan Tejada 9e91d9518a [none] (dev) Fix script name 2017-03-07 12:33:29 -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
Evan Morikawa a4de75d3ec [dev] change npm script names
Summary:
`npm run cloud` felt nicer than:
`npm run start-cloud`

Test Plan: manual

Reviewers: juan, spang, mark, khamidou, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4124
2017-03-07 14:54:30 -05:00
Evan Morikawa 67b7a335de [dev] use .cmd versions for Windows
Since spawn on Windows can't accept scripts like exec can :(
2017-03-07 14:50:34 -05:00
Evan Morikawa fc3dde9111 [dev] fix AppVeyor lerna bootstrap command
Needs to include `.cmd` for windows lerna builds
2017-03-07 14:43:45 -05:00
Mark Hahnenberg b119b43f82 [client-sync] Don't throttle message processing when syncing specific UIDs
Summary:
This diff adds a timeout parameter to queueMessageForProcessing that can
be used to override the CPU-throttled-by-default timeout used by the
message processing queue. The FetchMessagesInFolder sync task now
overrides with a timeout of 0 when it is queuing specific UIDs that it
has downloaded. The thinking here is that if we've requested a specific
set of UIDs, it's very important to sync those quickly as this indicates
a higher priority (e.g. initial inbox sync, search result syncing, etc).

Test Plan: Run locally, verify that initial sync and search syncing run faster

Reviewers: spang, evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4114
2017-03-07 11:34:19 -08: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
Evan Morikawa 428392fb51 [*] use hardlinked .babelrc for AppVeyor
Since babel-node won't work on AppVeyor if the babelrc is symlinked
2017-03-07 14:11:16 -05: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 55ec77a209 wip 2017-03-07 00:24:07 -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
Evan Morikawa 3c1c70e262 [client-app] use forked lerna for better npm logging 2017-03-06 15:35:56 -05:00
Juan Tejada 8bd6fe63aa [client-app] Fix build, add jasmine to iso-core deps 2017-03-06 11:36:03 -08:00
Evan Morikawa 2e89d4f643 [*] remove travs_wait now bootstrap more verbose 2017-03-06 14:13:12 -05: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 8eea5fa8ac [client-sync] Improve reporting of refresh access token errors
Summary:
Add better messaging and logging to the console.

Depends on D4098

Test Plan: manual

Reviewers: evan, khamidou, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4099
2017-03-06 09:55:25 -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
Juan Tejada 8bd686bc6e [client-sync] Sync accounts when app comes back online
Summary:
Given that we backoff exponentially in the sync loop when we encounter
RetryableErrors (e.g. network errors), if the app goes offline and
reaches the maximum retry backoff of 5 minutes, and if then the app comes
back online, in the worst case, the sync loop will idle for 5 minutes before trying to
sync, which is undesireable.

To mitigate this, everytime we come online we can wake all of the sync
workers. This shouldn't have any adverse effects

Test Plan: manual

Reviewers: evan, mark, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4097
2017-03-06 09:50:47 -08:00
Evan Morikawa c0510f6015 [*] increase loglevel for lerna bootstrap 2017-03-06 12:17:30 -05:00
Juan Tejada c088e86110 [client-app] Include node-mac-notifier in build
Summary:
Given that `lerna bootstrap` does not install optional dependencies, we
need to manually run `npm install` inside `client-app` so
`node-mac-notifier` get's correctly installed and included in the build

See https://github.com/lerna/lerna/issues/121

Fixes T7887

Test Plan: manual

Reviewers: halla, evan

Reviewed By: evan

Maniphest Tasks: T7887

Differential Revision: https://phab.nylas.com/D4076
2017-03-06 09:15:17 -08:00
Evan Morikawa fc2557051c [*] add travis_wait to build 2017-03-06 11:37:01 -05:00
Evan Morikawa d53b39f344 [client-app] resolve symlinks in spec 2017-03-06 09:42:59 -05:00
Juan Tejada 225613565a [client-sync] Use ExponentialBackoffScheduler for sync loop retries
Summary:
This is mostly to clean up the logic here a little bit.

Specifically:

- The backoff when encountering retryable errors is now truly exponential
- When encountering a permanent error, we back off for a minute
- If we don't encounter consecutive RetryableErrors, we clear the exponential backoff. Previously, we would just clear it when sync completed without errors.

Test Plan: manual

Reviewers: khamidou, spang, evan, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4086
2017-03-05 23:17:20 -08: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 4e1f03c072 [isomorphic-core] move devDependencies from iso-core to repo root 2017-03-03 14:17:39 -08:00
Evan Morikawa 42a0fa033e [client-app] fix keychain issue on OSX build 2017-03-02 17:56:09 -08:00
Mark Hahnenberg 8d057ca256 [client-sync] Refactor GmailSearchClient to use X-GM-RAW
Summary:
Previously we used the Gmail REST API to get search results. This API
returns the X-GM-MSGID which is different from the folder UID. Gmail also
offers the X-GM-RAW extension for IMAP's UID SEARCH command which allows
us to pass through the raw search query. This enables us to vastly
simplify the GmailSearchClient by having it subclass ImapSearchClient
and override a few select methods. Yay!

Test Plan: Run locally, verify that Gmail search queries still work

Reviewers: evan, spang, juan

Reviewed By: spang, juan

Differential Revision: https://phab.nylas.com/D4094
2017-03-02 17:27:07 -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 6557618cb4 [iso-core] 🎨 Rename imap-pool.es6 to imap-connection-pool
To be consistent with the name of the exported module
2017-03-02 14:45:34 -08:00
Juan Tejada 04fab196f2 bump(version) 1.0.31 2017-03-02 12:10:50 -08:00
Halla Moore 4c6848d5df [*] Change the symlink location for the isomorphic-core specs
Summary:
Put them in the client-app/spec folder instead of
client-app/internal_packages

Test Plan: Ran the tests

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4080
2017-03-02 10:56:03 -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 0cf6027482 [iso-core] Fix IMAPConnection.openBox
Set _isOpeningBox to true at the right moment
2017-03-01 17:19:21 -08:00
Juan Tejada 606dd6ea4b [none] Update .eslintrc
Ignore `no-unresolved` errors when importing from isomorphic-core
2017-03-01 16:57:03 -08:00
Juan Tejada df96678470 [client-sync] 🎨 lint errors 2017-03-01 15:48:16 -08:00
Juan Tejada 830b300ebc [cloud-*] (imap) 🎨 Fixup imap settings resolution in gmail auth
Summary: `generateXOAuth2Token` seems to be better placed inside gmail-oauth-helpers

Test Plan: none :(

Reviewers: khamidou, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4048
2017-03-01 15:27:21 -08:00
Juan Tejada 3a626988c8 [iso-core] Protect from operating on IMAP connection while opening a box
Summary: See title

Test Plan: manual

Reviewers: spang, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4072
2017-03-01 15:25:10 -08:00