Commit graph

5377 commits

Author SHA1 Message Date
Michael Grinich 05da3a6c0d Update documentation with GitBook 2017-01-30 02:38:37 -08:00
Juan Tejada d1ea16d7ee [cloud-*] Move babel devDependencies to dependencies in pkg.json
Our Dockerfile only install production dependencies `--production`, so
lerna and babel dependencies need to be listed under `dependencies`
2017-01-28 02:23:03 -08:00
Juan Tejada f56a807792 [cloud-*] Fix n1-cloud build
We added new presets and plugins to the k2 .babelrc but didn't add the
respective dependencies in our package.json, so the build was failing.

Add the required dependencies, and make sure that `build-n1-cloud.js`
uses the correct babel presets and plugins
2017-01-28 02:00:16 -08:00
Juan Tejada c7037d06a1 bump(k2) 2017-01-28 01:40:18 -08:00
Evan Morikawa 9be018b489 bump(k2) 2017-01-27 17:49:38 -05:00
Evan Morikawa 667f4dd87d bump(k2) 2017-01-27 17:46:39 -05:00
Juan Tejada 82b3033861 fix(tasks) ChangeMailTask should depend on EnsureMessagesInSentFolder
Summary:
See title
Add specs

Test Plan: unit

Reviewers: halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D3805
2017-01-27 14:02:50 -08:00
Juan Tejada 469cbad22b [local-sync] Fix compilation of FetchNewMessagesInFolder operation
Summary: This was broken because babel could not compile the `super` keyword

Test Plan: manual

Reviewers: evan, mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3804
2017-01-27 13:57:19 -08:00
Evan Morikawa 556f4a6c6f Use babel-cli in devDependencies instead 2017-01-27 16:34:16 -05:00
Evan Morikawa 6d7a1e9224 Make K2 babelrc match Nylas Mail babelrc 2017-01-27 16:31:02 -05:00
Evan Morikawa 44e7e58b4f Add babel-node as a dev dependency 2017-01-27 16:26:35 -05:00
Juan Tejada bf69357c01 bump(changelog) 2017-01-27 12:54:57 -08:00
Juan Tejada f6b4cfdacb bump(version) 1.0.17 2017-01-27 12:51:49 -08:00
Juan Tejada 5b11097172 bump(k2) 2017-01-27 12:50:35 -08:00
Juan Tejada b4973589f0 [local-sync] Sync new uid in sent folder when moving to msg to sent
Summary:
EnsureMessageInSentFolder also needs to sync the sent folder to fetch
the uid of the newly moved message (like `MoveThreadToFolder` does)

Test Plan: manual

Reviewers: halla, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3803
2017-01-27 12:50:19 -08:00
Juan Tejada e29fe2ee9b [local-sync] When fetching /new/ messages, make sure we have fetchedmax
Summary:
In `FetchNewMessagesInFolder`, sometimes we haven't synced anything in the folder
we are trying to fetch new messages in. Previously this would just throw
an error, now we properly check if we have a fetchedmax, and if not just
run a normal fetch.

Also, when the target folder box was already open, we were not fetching the /latest/ box status to check the latest uidnext value, so we would skip fetching new messages when in fact there were new messages to fetch

(This can happen for example when moving a sent message to the Sent
folder before we've started syncing the Sent folder)

Test Plan: manual

Reviewers: halla, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3802
2017-01-27 12:49:18 -08:00
Juan Tejada a0356ca76f [cloud-*] Add more detailed logs to auth endpoints
Summary: see title

Test Plan: manual, deploy to staging, check that it works

Reviewers: evan, spang, tomasz, khamidou

Reviewed By: tomasz

Differential Revision: https://phab.nylas.com/D3800
2017-01-27 11:48:06 -08:00
Evan Morikawa 3441df3a65 bump(k2) 2017-01-27 14:19:48 -05:00
Mark Hahnenberg 0d61af5f03 [search-index] Embiggen Thread and Contact indexes
Summary: See diff title

Test Plan: Run it

Reviewers: juan, mg, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3794
2017-01-27 10:30:45 -08:00
Juan Tejada 6252f94bb0 bump(changelog) 2017-01-27 09:09:18 -08:00
Juan Tejada 3aaf91ee93 bump(k2) 2017-01-27 08:29:27 -08:00
Juan Tejada 575ff4a73e [local-sync] Ensure messages always have a uid after syncback tasks
Summary:
Syncback tasks that move messages to a different folder used to leave
those messages without a uid because it was unknown at the moment, and
it would only be discovered later on in the sync loop.
This had the unwanted effect of not allowing you to perform more than 1
syncback action on the same thread back to back (e.g. undoing an archive, or
sending and archiving immediately)

This commit makes it so that `SetThreadFolderAndLabels` and
`MoveThreadToFolder` runs a new sync task to fetch the new uids for the
moved messages.

We do this via a new sync task, `FetchNewMessagesInFolder` which /only/
fetches new messages in a folder (no fetching old messages or attribute
updates). This is a first step to cleaning up the gigantic
`FetchMessagesInFolder` task into smaller parts-- but that will come in
a separate diff. For now we want to fix the immediate problem.

See D3788 and D3789 for more details

Test Plan:
manually move threads around, undo moving threads, reply on a thread
and immediately archive

Reviewers: khamidou, mark, spang, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3798
2017-01-27 08:28:33 -08:00
Evan Morikawa dfc09254e6 bump(version): 1.0.16 2017-01-27 10:11:27 -05:00
Evan Morikawa bb560af023 bump(changelog): 1.0.16 2017-01-27 10:11:09 -05:00
Juan Tejada 4480fd89a2 [local-sync] Correctly check presence of messages when updating thread
Summary:
updateMessagesFromThread requires `messages` to be an array only when
recompute is falsy

Test Plan: manual

Reviewers: halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3797
2017-01-26 16:08:17 -08:00
Juan Tejada 651a199cb6 [local-sync] Correctly check uidvalitity when syncing and save when updated
Summary:
If there were any uidvalidity changes after we've completely synced a folder, we
would completely ignore them and not attempt to sync the folder.

Also, we weren't saving the latest uidvalidity from the box to the folder
syncState as soon as we recovered, we only saved it until after fetching
messages. This meant that if the operation was interrupted before updating
syncState.uidvalidity, we would always think that we were in a state of uid invalidity

Recovering from uidvalidity was also broken because we weren't resetting the
fetched ranges, and unnecessarily setting the folderId to null, which meant that
we would never restore the uids of messages we had already fetched.

Test Plan: manual

Reviewers: evan, khamidou, mark, halla

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D3796
2017-01-26 16:05:18 -08:00
Juan Tejada 668be7463d [local-sync] Correctly close imap connections when downloading files
Summary: Addresses T7708

Test Plan: manual

Reviewers: evan, khamidou, mark, halla

Reviewed By: khamidou, mark, halla

Subscribers: halla

Differential Revision: https://phab.nylas.com/D3795
2017-01-26 15:27:56 -08:00
Mark Hahnenberg 9acb8b48a8 [spellcheck] Fix spellcheck debouncing
Summary:
Previously we were only debouncing one function in onContentChanged. This would
cause us to do very expensive things on every keypress in the things that
weren't debounced. This diff changes things so that we debounce the entire
process of running the spellchecker.

Test Plan:
Run locally, make sure spellchecker doesn't run on every keypress.
Misspell lots of things, type really quickly, paste large chunks of text
into the composer.

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3791
2017-01-26 13:40:45 -08:00
Juan Tejada f6193f9114 bump(k2) 2017-01-26 13:38:40 -08:00
Juan Tejada ded002924a [local-sync] Make invalid imap box errors retryable
Summary:
If we attempt to operate on a box that is no longer open, we should make
the error retryable so that we re-open the correct box and continue
syncing instead of showing the scary red box to users

Addresses T7680

Test Plan: manual

Reviewers: evan, spang, halla, mark

Reviewed By: halla, mark

Subscribers: mark

Differential Revision: https://phab.nylas.com/D3792
2017-01-26 13:32:39 -08:00
Juan Tejada 1d96c3f4da [local-sync] Ensure syncback actions have uids available before running
Summary:
Given that we perform syncback actions optimistically, i.e. we save the changes to the database before they are synced, some messages might not have an IMAP UID if they haven't been synced in the loop.

When we encounter messages without uid, we could just skip them, but this would mean that we end up moving only a subset of the messages we intended to move, or not move any at all, while thinking that we /did/ move everything, which might cause the thread to bounceback later on when we sync the messages that were missing.

The permanent fix is for syncback actions to not succeed until their changes have been synced, which is coming up in a separate diff

Test Plan: manual

Reviewers: evan, spang, khamidou, mark

Reviewed By: mark

Subscribers: mark

Differential Revision: https://phab.nylas.com/D3789
2017-01-26 13:31:53 -08:00
Juan Tejada 6dc9bbf412 fix(tasks) Notify when actions on threads fail
Summary: It is better to notify that a task failed rather than having a thread or group of threads randomly bounce back.

Test Plan: manual

Reviewers: evan, spang, mark, halla

Reviewed By: mark, halla

Subscribers: mark

Differential Revision: https://phab.nylas.com/D3790
2017-01-26 13:30:40 -08:00
Juan Tejada 78cdf32761 bump(k2) 2017-01-26 09:19:42 -08:00
Juan Tejada f98b9449bf [local-sync] Fix transaction syntax 2017-01-26 09:19:17 -08:00
Juan Tejada c996af3b36 bump(k2) 2017-01-26 09:11:01 -08:00
Juan Tejada 2391f58dfc Add comment 2017-01-26 00:06:20 -08:00
Juan Tejada 073310f49f [local-sync] Make sure folder move syncback actions clear folderImapUID 2017-01-26 00:06:20 -08:00
Juan Tejada 54ca43e48e fix(plugins) Unbreak plugins support in Nylas Mail
Properly use plugins specified in babelrc.json when using the babel
compiler. #3187
2017-01-25 22:41:54 -08:00
Karim Hamidou 318b8eb006 Snooze and send-later worker is running on a single worker right now. 2017-01-25 16:57:56 -08:00
Juan Tejada 5a67198226 bump(version) 1.0.15 2017-01-25 16:47:04 -08:00
Juan Tejada 0eaa184a4a bump(k2) 2017-01-25 16:37:54 -08:00
Christine Spang 6ddabff389 [local-sync] Avoid skipping All Mail updates if no new messages during Gmail inbox sync
Summary:
In JavaScript, null <= null is truthy. So if you set fetchedmax but not
fetchedmin and minUID, and then highestmodseq doesn't increment, we will
incorrectly skip updates on All Mail after the first batch of Gmail
inbox UID downloads, only making further progress on sync if the user
receives a new mail.

This patch tightens isSyncComplete() to require that all variables used
in the math comparisons are set.

Test Plan: manual 😢

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3787
2017-01-25 16:31:20 -08:00
Karim Hamidou 44d47ce278 Changes to get the cloud workers to run in our staging environment
Summary:
Summary of the changes:
- renamed some files to es6 to be able to use babel
- only try to create a db folder when we're using sqlite
- drop use of redis
- create a skeleton folder for workers.

Test Plan: Works on staging.

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3784
2017-01-25 16:26:40 -08:00
Juan Tejada 7beff5bae4 fix(onboarding) Allow users who only have custom imap to auth
Summary:
Users who only had a custom imap account could not open the window to
add a custom imap account the first time the auth was opened, rendering
the app useless for them.

Github issue #3185 and T7691

Test Plan: manual

Reviewers: halla, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3783
2017-01-25 15:06:58 -08:00
Mark Hahnenberg 7bf8d18a02 Don't register to receive IPC for hot windows
Summary:
These windows don't need to receive IPC until they're being used for something
(i.e. after transitioning from hot window to composer, popout, etc)

Test Plan:
Run locally w/ hot windows shown, make sure that hot window doesn't
receive IPC

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3780
2017-01-25 14:54:38 -08:00
Mark Hahnenberg 6946bda2bd Use meaningful names for helper processes
Summary: See diff title

Test Plan: Run locally, check in htop for new titles

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3778
2017-01-25 14:54:13 -08:00
Evan Morikawa 14514a3413 fix(specs): change spec scheduler back to setTimeout
Summary:
Adds a new `npm run test-window` that will launch specs in a window so you
can use the debugger

The spec window wouldn't close because `onbeforeunload` was unnecessarily
preventing close. This circumvents this in spec mode.

Most significantly I discovered we can't use the synchronous timer for the
promise scheduler anymore. Suppose you do:

```
it('should error', async () => {
  try {
    await doSomething()
    throw new Error("doSomething should have thrown!")
  } catch (err) {
    expect(err.message).toMatch(/my message/)
  }
})
```

The way async/await is transpiled, when `doSomething` throws, the error
will propagate all the way back up to the uncaughtPromiseException handler
before the `catch` gets called and registered. The transpilation method
assumes that when the function gets executed it can synchrously advance
beyond the call before the `then` or `catch` resolve. When the promise
scheduler is synchronous this doesn't happen.

I chose to use `setTimeout` instead of `process.nextTick` or
`setImmediate` as the promise scheduler. `setTimeout` seems to work better
with Chrome's async function call stacks. `nextTick` and `setImmediate`,
being Node methods, skip Chrome's async watchers.

Test Plan:
I talked with Juan about these changes, in an upcoming diff he will be
testing these in the context of our broader test suite.

Reviewers: mark, khamidou, halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3779
2017-01-25 17:43:11 -05:00
Evan Morikawa 2fe1368aa9 bump(k2) 2017-01-25 17:11:45 -05:00
Mark Hahnenberg 7ad9e36cec [local-sync] Set isBatteryCharging on startup
Summary:
Previously we just assumed that we were in the "charging" state and wouldn't
update that until the state changed. This would cause us to throttle even if
the app was opened while plugged in. Now we don't do that.

Test Plan: Run locally, verify that we no longer throttle

Reviewers: spang, evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3782
2017-01-25 14:03:29 -08:00
Juan Tejada 85d41839c1 bump(k2) 2017-01-25 13:53:17 -08:00