Commit graph

5365 commits

Author SHA1 Message Date
Jeremy Price f66bd8643b [n1cloud][docker][logs] added pm2 wrapper for logs
Launching pm2 via a wrapper that launches pm2 as a daemon in the background
and then runs pm2 logs --raw in the foreground. This gets us the logs that
we want without the additional cruft that pm2 outputs by default
2017-02-16 17:29:59 -08:00
Christine Spang 25d88589ba fix(linux-build): Update rpm spec to use new package name 2017-02-16 16:58:27 -08:00
Christine Spang 2bc6b7ac0f fix(linux-build): Change package name to Nylas Mail
Need this in order to allow parallel installation of Nylas Pro and Nylas
Mail.
2017-02-16 16:07:36 -08:00
Christine Spang 15697a9064 fix(cli): s/n1/nylas-mail/ 2017-02-16 16:02:08 -08:00
Juan Tejada 3978ee0dd0 Update .arcconfig to point to new repo
Summary: see title

Test Plan: manual

Reviewers: spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D3945
2017-02-16 14:15:19 -08:00
Evan Morikawa 9407533f51 [client-*] Rename packages folders and update readme 2017-02-16 13:31:37 -08:00
Evan Morikawa 84e2c75ce9 Merge remote-tracking branch 'k2/master' 2017-02-16 13:20:20 -08:00
Evan Morikawa 9f6889b03f [nylas-mail] move nylas-mail into /packages 2017-02-16 13:15:10 -08:00
Evan Morikawa ebac4275cb fix(SFDC): fix React error in tokenizing text field
Summary:
Get ready for some SFDC diffs! Hooray getting more eyeballs on SFDC. At
this stage it's a lot of FYI to hopefully start showing more people parts
of the SFDC plugin.

This is related to the form you use to create new Salesforce Objects with.

The form window basically looks like:
```
<SalesforceObjectFormWithWindowProps>
  <SalesforceObjectForm>
    <GeneratedForm>
      <GeneratedFieldset>
        <FormItem type="input" />
        <FormItem type="email" />
        ... (lots of FormItems)
        <SalesforceObjectPicker>
          <TokenizingTextField>
            <Menu>
              some placeholder that had an error fixed by this diff!!!
            </Menu>
          </TokenizingTextField>
        </SalesforceObjectPicker>
        <FormItem type="checkbox" />
      </GeneratedFieldset>
    </GeneratedForm>
  </SalesforceObjectForm>
</SalesforceObjectFormWithWindowProps>
```

The whole GeneratedForm is controlled by an obejct called `formData`. This
is documented in `GeneratedForm`.

This bug prevented me from properly using SalesforceObjectPickers inside
my form.

Test Plan: manual

Reviewers: mark, halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3935
2017-02-16 12:36:06 -08:00
Evan Morikawa 41bc1e5f5c [local-sync] fix related threads
Summary:
When saving a thread, we weren't properly setting the `participants`
object. Since Sequelize has object properties under getters and setters,
doing `this.participants.push()` did nothing.

Since threads had no `participants`, the related threads widget, which
queries through there, did nothing.

Test Plan: Manually inspect DB and use the related threads widget

Reviewers: halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3938
2017-02-16 12:33:52 -08:00
Evan Morikawa 9932fa4882 [*] update package.json to lerna specs
Summary:
This is the result of auto package.json fixing by lerna. Would be nice to
commit this so you can run script/bootstrap without it making local
changes.

I didn't manually bump any versions.

Test Plan: manual

Reviewers: mark, halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3934
2017-02-16 12:32:07 -08:00
Christine Spang 3837e165c3 fix(watchman): There's some stuff in build/ we don't want to ignore 2017-02-16 12:17:17 -08:00
Evan Morikawa 75f38ec7cd fix(spec): re-enable NylasEnv specs and fix duplicate rejection log
Summary:
This re-enables NylasEnv spec and fixes a particularly tricky test
involving the Node event loop.

See the comments I left on process.unhandledRejection and the new spec

Test Plan: Manually run test in isolation and whole suite. All green!

Reviewers: juan, mark, halla, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D3942
2017-02-16 12:15:51 -08:00
Juan Tejada a42d67a77a 🎨(backoff-scheduler) Add getters 2017-02-16 12:15:17 -08:00
Mark Hahnenberg d654e80a96 [local-sync] Use new BatteryStatusManager to compute sync loop delay
Summary:
We don't need to check folders that often while on battery. Check every
5 minutes rather than every 10 seconds.

Test Plan: Run locally, verify the timeout is longer while on battery

Reviewers: evan, spang, juan

Reviewed By: spang, juan

Differential Revision: https://phab.nylas.com/D3940
2017-02-16 10:35:24 -08:00
Juan Tejada 000fa88ebb bump(version): 1.0.28 2017-02-16 00:18:52 -08:00
Juan Tejada aa105ff83f update(changelog) 2017-02-15 23:22:32 -08:00
Juan Tejada cd91a1777a bump(k2) 2017-02-15 22:10:46 -08:00
Mark Hahnenberg 71e2397ef3 [battery] Add BatteryStatusManager
Summary:
This adds a simple service to monitor whether the computer is plugged in
or not.

Test Plan: Run locally, verify that we correctly detect battery charging state

Reviewers: evan, spang, juan

Reviewed By: evan, spang, juan

Differential Revision: https://phab.nylas.com/D3937
2017-02-15 19:33:27 -08:00
Juan Tejada e15079874b [local-sync] 🎨 sync loop error handler
Summary: See title

Test Plan: manual

Reviewers: evan, mark, spang

Reviewed By: spang

Subscribers: mark

Differential Revision: https://phab.nylas.com/D3932
2017-02-15 18:46:41 -08:00
Mark Hahnenberg 5f4e5cbbdf [sentry] Don't use breadcrumbs in dev mode
Summary: They obscure the location of our logs in the dev tools.

Test Plan: Run locally, verify that logs link to proper place

Reviewers: evan, spang, juan

Reviewed By: spang, juan

Differential Revision: https://phab.nylas.com/D3939
2017-02-15 18:38:55 -08:00
Evan Morikawa f7e5683ec7 bump(K2) 2017-02-15 15:09:45 -08:00
Christine Spang dce9743283 [local-sync] Refresh Google OAuth2 tokens when Invalid Credentials occurs in sync loop
Summary:
Previously, we would only refresh Google OAuth2 access tokens at the
beginning of the sync loop, and _only_ if the access token had already
expired. This meant that if an access token expired in the middle of a
sync loop iteration, the user would get prompted with the reauth red box
for their account and would have to either go through the oauth flow
again or restart the app for sync to continue.

This diff makes two changes:

1. Adds 5min of padding to the refresh window, so if a token will expire
in <5min, we'll go ahead and refresh the token. This will reduce the
possibility that an access token can expire during a sync loop
iteration.

2. Catches Invalid Credentials IMAPAuthenticationErrors for Gmail
accounts and forces a token refresh on the next sync loop.

These should prevent a user from _ever_ having to reauth their Gmail
account unless the refresh token is revoked, or we encounter some other
permanent error trying to refresh the token.

Fixes T7775 (at least some cases)

Test Plan: manual

Reviewers: khamidou, evan, juan

Reviewed By: juan

Maniphest Tasks: T7775, T7755

Differential Revision: https://phab.nylas.com/D3908
2017-02-15 14:37:31 -08:00
Christine Spang 56422eee10 Add TODOs about retries in sending 2017-02-15 14:23:38 -08:00
Juan Tejada 8cbbc3ee1b fix(exports) Add backoff schedulers 2017-02-15 13:21:27 -08:00
Juan Tejada 152287b98c bump(k2) 2017-02-15 12:33:32 -08:00
Juan Tejada d3f0847f79 [local-sync] Add exponential backoff when retrying syncback tasks
Summary:
Instead of re-implementing exponential backoff, throw the retryable
error so the sync loop handles it and backs-off

Test Plan: manual

Reviewers: spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3914
2017-02-15 12:31:43 -08:00
Juan Tejada a011d12b74 feat(offline) Re add offline status notification
Summary:
This commit rewrites the offline status notification from scratch, using
the `is-online` module (https://github.com/sindresorhus/is-online). The
react component no longer manages all of the state internally, but
rather depends on a separate OnlineStatusStore that manages the online state
for that component.

The new online status system will:

- Check online status every 30 seconds
- If status switches to offline:
  - Show notification
  - Recheck online status using exponential backoff
  - Notification will show remaining seconds until next online status
  check (like slack) (upon initial inspection this seemed to have no cpu problems.)
- If status switches to online
  - Hide notification
  - Revert to checking online status every 30 seconds

Depends on D3919

Test Plan: manual

Reviewers: spang, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3920
2017-02-15 12:30:28 -08:00
Evan Morikawa 532e096a21 bump(k2): SFDC 2017-02-15 11:33:37 -08:00
Evan Morikawa f409bf8be1 [SFDC] Update SalesforceSearchIndexer for new search indexing
Summary:
Update Salesforce to use the new search indexer

Depends on D3911

Test Plan: Manually bootup SFDC and ensure it launches and indexes models properly

Reviewers: mark, halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3913
2017-02-15 11:33:28 -08:00
Evan Morikawa 1526bbc31b reafctor(scheduler): Move SearchIndexer -> SearchIndexScheduler
Summary:
This renames `SearchIndexer` to `SearchIndexScheduler`

It also moves it out of internal_packages and into src/ since this is now
used across packages (like in Salesforce).

It also makes the class a Singleton and exports that instead so we don't
need to pass it via `activate`. The `activate` method of many stores and
packages are designed to be argumentless.

Test Plan:
Boot up Nylas and ensure it's still indexing threads properly.
Also allows Salesforce to bootup with the SalesforceSearchIndexer

Reviewers: juan, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D3911
2017-02-15 11:32:45 -08:00
Juan Tejada 9e5d14bf84 feat(backoff-scheduler): Add a backoff scheduler service
Summary:
This will help us dry up exponential backoffs we have scattered in
several places

Test Plan: unit tests

Reviewers: mark, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3919
2017-02-15 11:16:28 -08:00
Christine Spang 7eb1483fc5 bump K2 2017-02-15 08:35:08 -08:00
Christine Spang 04478f81c8 [cloud-api,cloud-workers,local-sync] Bump hapi version
We were two major versions behind. I upgraded and everything is working fine
in dev.
2017-02-15 07:55:48 -08:00
Christine Spang c8d1daddf4 Bump pm2 version to 2.4.0
See https://github.com/Unitech/pm2/blob/master/CHANGELOG.md
for new features and fixes
2017-02-15 07:54:55 -08:00
Juan Tejada ee5f9f7b90 bump(k2) latest master 2017-02-14 18:28:53 -08:00
Juan Tejada 78f67d4a76 [cloud-api] KEEP Timeout streaming API connections every 15 minutes
This reverts commit a1b997f350.
This is actually working correctly to reduce REDIS connections
2017-02-14 18:28:07 -08:00
Juan Tejada 4c2867d4c3 fix(offline): Really remove offline notification 2017-02-14 18:25:38 -08:00
Evan Morikawa a1b997f350 Revert "[cloud-api] Timeout streaming API connections every 15 minutes"
This reverts commit 6e43c86a95.
2017-02-14 17:55:08 -08:00
Juan Tejada d1bd77d11b [cloud-*] Properly listen to stream disconnect events to close redis connections
See the following for why we need to set up the listeners on the raw
stream.
http://stackoverflow.com/questions/26221000/detecting-when-a-long-request-has-ended-in-nodejs-express
https://github.com/hapijs/discuss/issues/322#issuecomment-235999544

Hapi's disconnect event only fires on error or unexpected aborts: https://hapijs.com/api#response-events
2017-02-14 17:02:31 -08:00
Evan Morikawa 11944a7183 bump(version): 1.0.27 2017-02-14 16:36:30 -08:00
Juan Tejada 1239e5fd78 fix(offline-status): Temporarily remove offline status notification
Summary:
This component was running into a hard loop trying to constantly, unnecessarily,
re-establish the delta connection to our n1cloud servers.

Test Plan: manual

Reviewers: mark, evan, spang

Reviewed By: evan, spang

Differential Revision: https://phab.nylas.com/D3918
2017-02-14 16:33:14 -08:00
Evan Morikawa b5ea67198e fix(delta): add backoff to delta error handling
Summary: Report delta errors and exponential backoff when errors arise

Test Plan: Manually throw Errors in various parts of the delta stream

Reviewers: spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3917
2017-02-14 16:09:27 -08:00
Karim Hamidou 6e43c86a95 [cloud-api] Timeout streaming API connections every 15 minutes
Summary: Should help a fair bit with our redis connection pileup.

Test Plan: Tested manually.

Reviewers: mark, spang, juan, evan

Reviewed By: mark, spang, evan

Differential Revision: https://phab.nylas.com/D3916
2017-02-14 14:43:23 -08:00
Mark Hahnenberg ddbf40c5ab [contact] Fixup Contact prefix/suffix removal for names
Summary:
We were doing a lazy job of removing prefixes and suffixes by filtering
any and all prefixes or suffixes from any part of a Contact's name which
was leading to some odd truncations.

Test Plan:
Run locally, verify that 'Nylas Mail General' contact has proper name
when participant text field is collapsed.

Reviewers: evan, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3904
2017-02-14 11:19:17 -08:00
Evan Morikawa 222b486082 bump(k2): adding accountId index 2017-02-14 10:49:18 -08:00
Evan Morikawa 4245ec7aa5 [isomorphic-core] add accountId index definition to Transaction table 2017-02-14 10:48:12 -08:00
Evan Morikawa 2825a3553e fix(delta): report error when delta gets invalid cursor 2017-02-14 10:46:53 -08:00
Evan Morikawa f07be909f4 fix(spec): re-enable DatabaseStore specs
Summary:
Re-enable DatabaseStore specs and use new async model that awaits for the
promises to resolve

Test Plan: new tests

Reviewers: spang, halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3909
2017-02-14 09:07:40 -08:00
Evan Morikawa 35807ad7d0 fix(db): wait for models to be setup before activating packages
Summary:
Some plugins (like the Salesforce Plugin) register Models with the
database store. Upon plugin load, we check to see if there are newly
registered models, if there are, we try and refresh the database.

Unfortunately the database refresh was not being `await`ed for. This means
the `activate` method of the plugin was called before the models were
created creating DB errors.

Making `refreshDatabaseSchema` something you can `await` for requied
adding an async ready hook on the DatabaseStore itself that will work in
all windows, even though setup is only happening in one window.

Test Plan:
Turn DatabaseStore.DEBUG_TO_LOG = true and run before and after the patch
with SFDC enabled. See that after the patch the DB setup happens before
activate gets called

Reviewers: halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3906
2017-02-14 09:03:57 -08:00