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
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
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
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
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
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
Summary: See title
Test Plan: manual
Reviewers: evan, mark, spang
Reviewed By: spang
Subscribers: mark
Differential Revision: https://phab.nylas.com/D3932
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary:
This commit makes it so we always continue retrying syncback tasks as long as they
error with a retryable error. There's really no reason to not continue retrying syncback
tasks after an arbitrary number of retries (especially such a low one) if we
encounter a retryable error. Before this commit, if for example we got 2 random
network errors in a row, we would just mark the task as failed even
though it would eventually succeed in subsequent attempts.
Previously, when N1 synced against the cloud api, we would indefinitely
retry a Task if we continued getting retryable errors. This ensures that
the app can work correctly offline and prevents displaying unecessary errors to
the user, and having actions bouncing back or sending messages without putting them
in the sent folder.
Additionally, this commit ensures that when cleaning up messages without a
folderImapUID we don't delete messages that are currently being added to the sent
folder. This is relevant to this commit because given that we could retry the
EnsureMessageInSentFolder task indefinitely, we might end up deleting that
message because it wont have a uid until the task succeeds.
Depends on D3898
Test Plan: manual
Reviewers: mark, spang, evan, halla
Reviewed By: spang, evan, halla
Differential Revision: https://phab.nylas.com/D3900
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
Summary:
Since all Nylas Mail actions are thread-based except for sending,
we never use any of these. Make `git grep` less confusing by getting rid
of them.
Test Plan: use the app
Reviewers: evan, halla, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3910