Commit graph

4519 commits

Author SHA1 Message Date
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
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
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
Evan Morikawa f7e5683ec7 bump(K2) 2017-02-15 15:09:45 -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 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 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
Juan Tejada ee5f9f7b90 bump(k2) latest master 2017-02-14 18:28:53 -08:00
Juan Tejada 4c2867d4c3 fix(offline): Really remove offline notification 2017-02-14 18:25:38 -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
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 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
Boris Kaiser a5501b57ef Fix broken link (#3284) 2017-02-13 21:53:57 -08:00
Juan Tejada fe46278390 fix(account) Properly keep tokens in sync between acct stores in different windows
Summary:
When loading accounts, if we detect any removed accounts, we should get
rid of the tokens for that account as well.

Test Plan: manually removed accounts, everything seems a-ok

Reviewers: mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3907
2017-02-13 21:40:18 -08:00
Juan Tejada b0e21b5381 fix(accounts) Don't report error when removing accounts
Summary:
The current error condition check is to make sure that accounts are exclusively
removed via `Actions.removeAccount`. However, when removing accounts,
the in-memory `AccoutStore`s in each window are kept in sync via listening
to the config, as opposed to dispatching Actions globally between windows
(Actions.removeAccount is scoped to a single window, see actions.es6).
So, when we remove an account in one window, config.json will change, and the
other windows will always encounter `removedIds.length > 0` to be true
when their `_loadAccounts` runs. This will only generate unecessary noise in Sentry.

Test Plan: manual

Reviewers: mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3902
2017-02-13 15:13:26 -08:00
Halla Moore a49f5b4a7d fix(tests): Fix some tests and add tests for thread metadata
Summary: Depends on D3875

Test Plan: run the tests

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D3876
2017-02-13 13:11:10 -08:00
Halla Moore 667afa2012 fix(metadata): Fix some issues with processing metadata deltas
Summary:
- Create ghost models if we receive metadata for an object we
    haven't synced yet
- Fix logic for finding equivalent threads
- Send `messageIds` when syncing thread metadata

See D3876 for unit tests

K2 pairing: D3880

Test Plan: unit tests, local testing soon

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3875
2017-02-13 13:10:38 -08:00
Juan Tejada 20374b4e9d bump k2 2017-02-13 13:08:34 -08:00
Juan Tejada f09eec711c fix(send) Add better error checking when sending message
Summary:
See title.
I believe this might fix T7559, or at least provide a better error message.

Depends on D3895

Test Plan: manual

Reviewers: spang, mark, halla, evan

Reviewed By: mark, halla, evan

Maniphest Tasks: T7559

Differential Revision: https://phab.nylas.com/D3897
2017-02-13 12:36:53 -08:00
Juan Tejada 1ea9853d12 fix(send): Correctly wait for send task to complete before succeeding!
Summary:
If the worker window were to restart or the app were to close in the
middle of a send task, sending to a single recipient, we would not
properly await the task and always mark as success.

This diff, along with (D3897) should fix T7559.

Test Plan: manual

Reviewers: spang, mark, evan, halla

Reviewed By: mark, evan, halla

Maniphest Tasks: T7559

Differential Revision: https://phab.nylas.com/D3895
2017-02-13 12:31:40 -08:00
Juan Tejada 8d875a6307 fix(offline-notif) Try to connect immediately upon window focus
Summary: see title

Test Plan: manual

Reviewers: mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D3901
2017-02-13 12:23:31 -08:00
Juan Tejada 06fe77bb21 bump k2 2017-02-13 12:21:16 -08:00
Christine Spang e71fb04bd8 feat(specs): Add support for generating JUnit XML by passing --junit-xml=<path>
Summary:
A prerequesite to integrating with `arc unit` or CI for each patchset is
being able to generate JUnit XML output for spec runs. This commit adds
this feature using the JUnitXMLReporter from jasmine-reporters. Invoke it like
this:

    npm run test-junit

(We output to the terminal as well when this is run, so in the case that
you're doing `arc diff` you have some idea of what is going on.)

Test Plan: run it

Reviewers: halla, juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D3891
2017-02-13 12:05:52 -08:00
Christine Spang d6a234e94a 🎨 s/N1/Nylas Mail/ in window-event-handler.coffee 2017-02-13 11:14:41 -08:00
Juan Tejada b984a27482 bump k2 2017-02-11 15:30:43 -08:00
Juan Tejada a5e6fae063 fix(syncback-category) Return error when task fails 2017-02-11 13:03:56 -08:00
Juan Tejada 81208062c0 fix(specs) Correctly set configDirPath when running tests
Before this commit, running the running the tests would clear all of
your config inside `.nylas-dev` and thus your accounts, forcing you to re-add
them everytime after you ran the tests

This was happening because we weren't correctly setting the
`configDirPath` to `.nylas-spec` when running with the --test flag. When
we run with --test, both options, `specMode` and `devMode` are true, so
the logic to set the path would fall into both conditions and ultimately
set the path to `.nylas-dev`. Now it's fixed!
2017-02-10 19:16:53 -08:00
Juan Tejada f4dbd555d1 fix(specs) 🔪 more side-effect flakiness 2017-02-10 19:01:17 -08:00
Juan Tejada d89887c20f fix(specs) Fix FeatureUsageStore spec flakiness 2017-02-10 16:48:06 -08:00
Evan Morikawa af6074f6f5 bump(changelog): 1.0.26 2017-02-10 18:43:51 -05:00
Evan Morikawa e92b668a1e bump(version): 1.0.26 2017-02-10 18:41:20 -05:00
Evan Morikawa 6f64e2f762 bump(changelog): 1.0.26 2017-02-10 18:41:20 -05:00
Halla Moore f86ff97062 fix(n1-spec-runner): Make fit async too
Summary: Running async tests with `fit` can fail otherwise

Test Plan: unit tests

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D3874
2017-02-10 15:41:07 -08:00
Halla Moore 0e5aebb91d fix(tests): Allow the masterBefore/AfterEach functions to be async
Summary:
The global `before/afterEach` functions were made async, but the
`masterBefore/AfterEach` functions were applied to the references
in `jasmineExports` instead of the global references. Fix that,
and await for `destroyTestDatabase()`. Also fix a random test
failure about not receiving any json.

This diff is necessary for D3878 to work properly.

Test Plan: ran the tests

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3890
2017-02-10 15:38:55 -08:00
Evan Morikawa 614992f550 bump(k2) 2017-02-10 18:21:06 -05:00