Commit graph

5652 commits

Author SHA1 Message Date
Mark Hahnenberg 2fe8bee38f [client-sync] Refactor sync worker IMAPConnectionPool callbacks
Summary: In preparation for removing timeout handling from the IMAPConnectionPool.

Test Plan: Run locally

Reviewers: spang, evan, juan

Reviewed By: evan, juan

Differential Revision: https://phab.nylas.com/D4245
2017-03-21 12:15:40 -07:00
Juan Tejada 65f9f8cdbe [client-app] 🎨 comment 2017-03-21 11:45:30 -07:00
Juan Tejada 8f5d36746d [client-app] Correctly sign out of NylasID
Summary:
This fixes T7995.

Previously, attempting to log out from your NylasID would just
automatically sign you back in with the same NylasID because the webview
session was preserved.

Now, instead of relaunching the windows, we restart the app to clear the
webview session

Test Plan: manual

Reviewers: halla, evan

Reviewed By: evan

Maniphest Tasks: T7995

Differential Revision: https://phab.nylas.com/D4224
2017-03-21 11:44:48 -07:00
Juan Tejada 6ea9ab3fbf [client-app] Don't report non-reportable errors in delta connection
Summary:
Previously, the logic for deciding wether to report an APIError lived
inside NylasAPIRequest and depended on an array of ignorable
statusCodes. However, when handling APIErrors, NylasAPIRequest would
convert special error codes (for offline errors) into a statusCode of 0,
which would automatically be ignored.

Given that the delta streaming connection didn't convert status codes to
0, it wouldn't actually ignore the error and end up reporting it,
flooding sentry.

This commit makes it so that that logic lives inside APIError, and
anyone who handles APIErrors can check wether to report them or not,
including the delta streaming connection

Test Plan: manual :(

Reviewers: spang, evan, halla

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4235
2017-03-21 11:43:41 -07:00
Juan Tejada 6048d6a80c [client-app] Update changelog 2017-03-21 10:39:40 -07:00
Nylas Coffee Machine 3b3057fd2d bump(version): 1.0.45 2017-03-21 09:30:12 -07:00
Juan Tejada d025aaf369 [dev] Actually fix tmp dir path in daily 2017-03-21 09:29:46 -07:00
Juan Tejada 17da34caed [dev] Fix temp dir path in daily 2017-03-21 09:25:46 -07:00
Juan Tejada 3554fb2510 [client-app] Fix passing cursor to delta streams
Summary:
Currently, when we auth an account for the first time in Nylas Mail (or
we blow away the database), the app is going to request transactions
since cursor `null` from the /delta/streaming endpoint and from the local-sync
delta observable, instead of requesting transactions since cursor `0`

This is due to a subtle bug with the use of default values when
destructuring an object. Our coded did the following:
```
const {cursor = 0} = this._state
```
Which at a glance seems correct. However, this will only work as
expected if `this._state` has the following shape:
```
{cursor: undefined}
```
And unfortunately, our `this._state` looked like this when authing an
account for the first time:
```
{cursor: null}
```

Which would make `cursor === null` instead of `0`.
This is because when using default values, null is considered an
intentional argument/value, as opposed to not passing any argument/value
(which will mean that the argument is undefined).

This was a regression introduced in d60a23c and 8bc2ec5

Test Plan: manual, will add regression test in upcoming diff

Reviewers: evan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4243
2017-03-20 16:16:46 -07:00
Juan Tejada 3909c8885a [cloud-api] Fix query for delta stream transactions
Summary:
When querying transactions for the delta stream, if no cursor is provided,
we should default to 0. Otherwise this will generate a query like:
```
WHERE `transaction`.`id` > ‘null’
```
Which is obviously wrong

Test Plan: manual

Reviewers: evan, halla, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4242
2017-03-20 15:39:24 -07:00
Nylas Coffee Machine d5b8e1993e bump(version): 1.0.44 2017-03-20 08:37:27 -07:00
Jeremy Price 180f92b78a [deploy-it] temp override for deploy branch rules
for ei-prod only.  I set up the ei EB env as prod level, but
have been working on launch changed in master branch. Easy enough to undo,
but I didn't wan't to mess with prod branch until done because
the launch scripts affect all the n1cloud-related environments.
2017-03-18 15:26:08 -07:00
Juan Tejada 6532d3c647 [client-sync] Add error handling when creating syncback requests
Summary: see title. also convert to es6

Test Plan: manual

Reviewers: evan, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4225
2017-03-17 13:59:37 -07:00
Juan Tejada eb64ae67d2 [client-app] Update changelog 2017-03-17 10:59:40 -07:00
Juan Tejada 64e6fefbd4 [client-app] Update changelog 2017-03-17 10:49:46 -07:00
Juan Tejada f1572f4bfc [dev] Fix path for tmp dir in daily script 2017-03-17 10:08:00 -07:00
Nylas Coffee Machine 27355c91eb bump(version): 1.0.43 2017-03-17 07:38:47 -07:00
Christine Spang e87bea789d Revert "[iso-core] Upgrade nodemailer"
This reverts commit e798e50d1a.

Reason for revert: breaks Send Later. Needs more testing.
2017-03-16 15:09:09 -07:00
Halla Moore 73e990fc05 [client-app] Don't show non-existent children on folder creation
Summary:
Previously, after creating a new folder, the UI would indicate that the new
folder had children, even though it didn't. This was caused by duplicate models
in our `MutableQueryResultSet` for the user's categories. Basically, we would
sync the server version of the folder before the `SyncbackTask` for the new
folder returned its `serverId`. Without the `serverId`, the synced version of
the folder couldn't yet be tied to the optimistic folder, so a second row was
created in the database. This second row is removed when the `syncbackTask`
does return the `serverId`, because we persist the optimistic folder with a
`REPLACE INTO` query. (This deletes other rows with the same id.) However,
since this was done inside a `persist` change with the `serverId` and no
`unpersist` was ever recorded for the `clientId`, our `MutableQueryResultSet`
never removed the `clientId` model.

To address this, this diff adds a check in `updateModel` to see if the
`serverId` is being added. If it is, and both the `serverId` and `clientId`
exist in the `_ids` list, we remove the `clientId`.

The children indicator does still briefly show up while there are still two
separate rows for that folder in the database. If we want to get rid of this
completely, we would have to ensure that we do not sync the folder before the
`syncbackTask` returns the `serverId`. However, this would probably be pretty
involved, and for not much gain. This fix is much simpler and reduces most of
the issue.

Test Plan: manual

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4228
2017-03-16 12:26:42 -07:00
Halla Moore 4492b73507 [client-sync] Only update lastReceivedDate if the message was actually received
Summary:
We don't want to bump threads to the top of the inbox when a user sends a
reply. We originally used `!isSent` to prevent this, but that was removed in
a diff that made sure messages showed up in the inbox when users send emails
to themselves. In order to implement both of these cases properly, this diff
introduces `isReceived` and uses that to determine whether lastReceivedDate
should be updated. Addresses T7991.

Also changes the order of some `or` statements, so that we actually check that
the variable exists before comparing against it.

Test Plan: manual

Reviewers: evan, juan, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4226
2017-03-16 12:25:56 -07:00
Nylas Coffee Machine 67f9d26d66 bump(version): 1.0.42 2017-03-16 12:14:19 -07:00
Evan Morikawa f4b01b3c13 [client-app] don't exclude source maps 2017-03-16 12:07:05 -07:00
Nylas Coffee Machine 4079fd4b98 bump(version): 1.0.41 2017-03-16 10:05:48 -07:00
Christine Spang e798e50d1a [iso-core] Upgrade nodemailer
Summary:
We were using a version that was ~9 months old and a lot of development has
happened since.

v3 is not compatible w/v2, but it looks like we aren't using any of the
features that had breaking changes:

    http://nodemailer.com/about/migrate/

I chose not to switch to the new built-in OAuth2 token refresh support
because we already have a mechanism for refreshing oauth tokens and
adding a different implementation specifically for SMTP would introduce
more opportunities for bugs.

Since mailcomposer is no longer a dependency of nodemailer, I added this
dependency as well.

Test Plan: manual - sent a message, sent a message w/an attachment

Reviewers: evan, khamidou, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4201
2017-03-15 16:24:32 -07:00
Nylas Coffee Machine c8e31a7812 bump(version): 1.0.40 2017-03-15 06:34:12 -07:00
Evan Morikawa 093f315f59 [client-app] don't bootsrap cloud stuff when building the client
Summary:
We don't need to spend the time running script/bootstrap in our cloud-*
folders!

Test Plan: manual

Reviewers: spang, juan, halla

Reviewed By: juan, halla

Differential Revision: https://phab.nylas.com/D4214
2017-03-14 13:39:56 -07:00
Evan Morikawa b3681e6567 [client-app] update files ignored in build
Summary:
The ignore list was very old. It included several dozen MB of docs_src and
other crap in our builds

Test Plan: manual

Reviewers: halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4213
2017-03-14 13:39:40 -07:00
Evan Morikawa 613ee2b568 [client-app] upload nupkg for Windows autoupdater
Summary: We need to upload the nupkg for the Windows autoupdater to work

Test Plan: manual

Reviewers: juan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4219
2017-03-14 13:35:09 -07:00
Karim Hamidou 3a92eaf857 [send-later] Add support for attachments
Summary:
This is going to be a diff way shorter than the previous one! Basically, it adds a new endpoint, `/blobs` to our API to store send later attachments. When a user schedules a draft to be sent, we send all attachments to this endpoint. Separately, we store the rest of the message as metadata.

When it's time to send the message, we fetch the attachments from S3, fetch the metadata and merge them together to get a message we can send.

Test Plan: Tested manually. Will make a final QA pass before landing.

Reviewers: juan, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D4196
2017-03-14 12:24:04 -07:00
Evan Morikawa 5b33cc1274 [client-app] "two panel" -> "Reading Pane On"
Summary: Minor copy change via Sachin

Test Plan: manual

Reviewers: juan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4218
2017-03-14 10:55:25 -07:00
Nylas Coffee Machine 27927e1f5c bump(version): 1.0.39 2017-03-14 10:44:15 -07:00
Juan Tejada 87acb233b7 [client-app] Fix missing depedency for imap-provider-settings 2017-03-14 10:42:30 -07:00
Evan Morikawa af7d8c98c6 [client-app] only upload 7 characters of the commit hash
Summary:
On windows running `git rev-parse --short HEAD` does in fact now give you
9 characters instead of 7 like it does on Mac. This will ensure that
builds get uploaded to the same folder and help ensure we don't post a
version that doesn't exist on the release page.

Test Plan: Manual

Reviewers: juan, halla, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4217
2017-03-14 10:37:24 -07:00
Juan Tejada 30792a47bf [client-app] Update changelog 2017-03-14 09:19:10 -07:00
Nylas Coffee Machine 3c88f9000a bump(version): 1.0.38 2017-03-13 22:58:30 -07:00
Juan Tejada 7fc1e043c1 [client-app] Restart sync when computer awakes from sleep
Summary:
Use electron's `powerMonitor` module to detect when the computer resumes
from sleep, and restart the sync loop when that happens in order to
sync the inbox immediately, in case we received any new mail events
while the computer was asleep

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4216
2017-03-13 22:44:09 -07:00
Juan Tejada f157ddb867 [client-app] Make resetEmailCache work without forcing re sign-in
Summary:
This commit makes it so `resetEmailCache` works as expected, i.e. it
removes all databases, without forcing the user to re sign-in to their
accounts or NylasID

Previously, this method removed the database without removing the
accounts, left users in an un-authed state that was hard to recover
from. This was fixed in D4212 which makes sure that when we get a new
identity, sync and deltas are restarted

However, resetEmailCache would still force you to log in to yoru NylasID
because it was deleted from the database. However, if we reuse the
command `application:relaunch-to-initial-windows` instead of manually
deleting the database, we can relaunc the app while preserving the users
NylasID session, so they don't have to sign back in manually.

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4215
2017-03-13 22:42:52 -07:00
Juan Tejada 4d1628b914 [client-app] Don't start sync or delta connections without an identity
Summary:
This prevents the app from entering a restart loop when there's no
identity.

Specifically, when a user logs out of their identity, or when she resets the
email cache, or any other scenario that leaves the app without an
identity but with accounts added, the sync loop (and deltas) will start
without an Identity.

This will cause NylasAPIRequest to throw an error that
forces the user to close the app. When the app restarts, sync will start
again without an identity, and the user will be forced to close the app
again, and so on and so forth for the rest of eternity

Relevant error:
https://github.com/nylas/nylas-mail-all/blob/master/packages/client-app/src/flux/nylas-api-request.es6#L165-L174

Additionaly, this makes sure that after resetting the email cache, the sync
process starts when the identity becomes available

This solves T7989

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4212
2017-03-13 20:00:59 -07:00
Juan Tejada 588163acda [client-sync] Correctly wait for sync to stop before resetting email cache
Summary:
Previously, while resetting the email cache, we would try to stop sync
and just wait for an arbitraty amount of time for it to stop and the
proceed to blow away the database.

This commit makes it so we correctly wait for sync to stop, and then we
blow away the db. It adds a timeout anyway in case sync is stuck and we
can't stop it

Depends on D4207

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: spang, halla

Differential Revision: https://phab.nylas.com/D4209
2017-03-13 19:57:58 -07:00
Juan Tejada ebe16aa1ae [client-sync]: Fix error in SyncProcessManager._resetEmailCache
Summary:
We no longer keep `this._accounts` state, which was being accessed
inside `_resetEmailCache`

Test Plan: manual

Reviewers: evan, spang, halla

Reviewed By: spang, halla

Differential Revision: https://phab.nylas.com/D4207
2017-03-13 19:56:37 -07:00
Juan Tejada a6684db5c4 [client-app] Update changelog 2017-03-13 19:51:02 -07:00
Evan Morikawa 59361a7734 [client-app] fix travis env variables 2017-03-13 16:05:50 -07:00
Evan Morikawa 1f2370c2a9 [client-app] run windows build separately
Summary:
build-client, aka packaging, aka bundling is now separate from uploading.
This is both to compartmentalize our tasks a bit more and so we can add a
non-grunt windows task inbetween packaging and uploading.

No more heavily-overloaded PUBLISH_BUILD flag.
Added SIGN_BUILD flag instead.
No more TRAVIS and TRAVIS_PULL_REQUEST flag.

Test Plan: Manual

Reviewers: halla, juan, spang

Reviewed By: juan, spang

Differential Revision: https://phab.nylas.com/D4208
2017-03-13 15:48:45 -07:00
Evan Morikawa e883122ccf [client-app] remove ability to run specs
Summary:
This removes specs from the build production version.

One of the major issues with the windows build was that one of the package
specs included a .node compiled file that the codesigner attempte to sign,
but couldn't find for some reason.

In testing, removing the specs from the build prod version fixed this.

While we could just remove the one offending test, I think we should just
remove the whole suite from the build version. That'd save in the number
of files we have to ship, save download time, save build time, and have
less chance for some symlinked issue failling a build in the future.

Test Plan: Manual

Reviewers: khamidou, halla, juan, spang

Reviewed By: juan, spang

Differential Revision: https://phab.nylas.com/D4206
2017-03-13 15:47:58 -07:00
Christine Spang 6588827c32 [iso-core] Pin imap-provider-settings package version
I'm about to make backwards-incompatible changes to this data in
preparation for supporting setting the 'ssl' bit separately for IMAP /
SMTP.
2017-03-13 13:58:30 -07:00
Christine Spang cd70f845b1 [client-app] Don't check for key membership on null
This bug snuck in when I landed the DeveloperBarCurlRequest fix
for the Content-Type header.
2017-03-13 12:24:46 -07:00
Christine Spang 7d229f6377 [client-app] Some wording improvements in IMAP onboarding
Summary:
It always drives me crazy when folks use "setup" (no space) as a verb,
because the verb version has a space in it.

Also remove the word "Setup" from the displayName for custom IMAP accounts
because it doesn't make sense for how we use this field, e.g.

a8f36b88d9/packages/client-app/internal_packages/onboarding/lib/page-account-onboarding-success.jsx (L27)

will display "Sucessfully connected to IMAP / SMTP Setup!" with the old
wording when you successfully auth a custom IMAP account.

Test Plan: manual

Reviewers: evan, juan, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4199
2017-03-13 11:50:43 -07:00
Christine Spang b69d5e50f1 [dev] Make 'arc lint' shut up about long lines
We don't warn about this in JS, so we shouldn't warn about this in coffeescript either.
2017-03-13 11:42:14 -07:00
Christine Spang 67fb8bed5c [client-app] Specify Content-Type in developer bar curl commands
Summary:
Dunno if I'm the only one having this problem, but I spent at least an
hour over the last two days wondering why hapi just sits there and hangs
in the Joi validation step when I copy-paste calls to /auth from the
developer bar to my terminal. It turns out that if you fail to send the
correct Content-Type when sending a JSON payload, Joi just hangs
forever. (WTF!)

Test Plan: manual

Reviewers: halla, evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4204
2017-03-13 11:38:06 -07:00
Christine Spang 73725afbe7 [dev] Fix 'arc lint' 2017-03-12 18:53:18 -07:00