Summary:
During the _onDOMMutated callback, we disconnect the mutation observer,
call some other callbacks, and then reconnect the mutation observer. If
we threw an error during the callbacks before reconnect the mutation
observer we would never get any more callbacks when the user changed
things in the composer, causing us to stop saving updates to drafts
(among other things). The fix is to just make sure that we always
reconnect the mutation observer using a finally clause.
Test Plan:
Run locally, make sure drafts are no longer truncated after spelling
correction (which was triggering an error to be thrown)
Reviewers: juan, evan, spang
Reviewed By: spang
Differential Revision: https://phab.nylas.com/D3864
Summary:
This diff (and the K2 counterpart diff) allow us to run dev-mode Nylas
Mail side-by-side with prod Nylas Mail.
There were 4 things that needed to change:
1. Use different config dir
2. Use different keychain name
3. Use different localhost port
4. Prevent Electron's app.makeSingleInstance from killing our app
All of these are activated through NylasEnv.inDevMode()
Depends on D3861
Test Plan:
Download latest prod build from nylas.com
Remove both ~/.nylas-mail and ~/.nylas-dev
Start up downloaded Nylas Mail, connect accounts.
Run `npm start` (which enables --dev)
Connect account to dev mode
Ensure both clients are syncing and can send/receive mail
Reviewers: khamidou, halla, mark, spang, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3862
Summary:
Snooze is back in the mainline but not yet ready for primetime. We need to not show the popover if it's not enabled, which is what this diff does. It should be pretty simple to revert it once snooze has officially shipped.
Fixes T7791.
Test Plan: Tested manually.
Reviewers: juan, evan
Reviewed By: evan
Maniphest Tasks: T7791
Differential Revision: https://phab.nylas.com/D3855
Summary:
This adds the "You've reached max features" modal in N1.
http://g.recordit.co/9O7R0mLlXE.gif
Test Plan:
1. Pull latest nylas/cloud-core and start Billing site:
```
cd cloud-core
vagrant up
vagrant ssh
cd /vagrant
bin/setup-up-feature-usage
bin/launch
```
2. Blow away ~/.nylas-mail (err backup your old one first)
3. Restart N1
4. Before logging in, edit `~/.nylas-mail/config.json`
- set env to "local"
- remove `thread-snooze` from the list of `disabledPlugins`
5. `cd /nylas-mail/src/k2` and run `npm start`
6. Restart N1 and create accounts & log in
Reviewers: khamidou, juan, halla
Reviewed By: halla
Differential Revision: https://phab.nylas.com/D3846
Summary:
FTS tables don't support indices, so doing UPDATEs and DELETEs based on
the `content_id` was very slow on large FTS tables. Fortunately, it seems
that `UPDATE`s and `DELETE`s based on the `rowid` are much faster, so now we
store that info hanging off the searchable models. Also fixes a random bug
where after reaching the `MAX_INDEX_SIZE` we would clear the Thread search
index on startup.
Test Plan: Run locally, time how long it takes to delete when receiving new mail
Reviewers: spang, evan, juan
Reviewed By: evan, juan
Differential Revision: https://phab.nylas.com/D3847
Summary:
It's slow, so only do it if we've never seen the Account before. This
fixes jank that would happen somewhat randomly. It was especially noticeable
if the user had a lot of Accounts (and therefore a lot of passwords to
load).
Test Plan: Run locally, verify that we only load new Accounts
Reviewers: spang, evan, juan
Reviewed By: evan, juan
Maniphest Tasks: T7766
Differential Revision: https://phab.nylas.com/D3848
Summary:
We don't want to overwhelm a user with a bunch of bings and bongs when
they open their laptop after a long weekend. This diff takes a
relatively simple approach by debouncing the notification sounds every 5
seconds.
Test Plan: Run locally, make sure we still get notified but not too much.
Reviewers: juan, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3841
Summary:
This commit converts list-tabular to JS, and in the process re-adds shouldComponentUpdate which had been previously removed (D3837).
This time, shouldComponentUpdate will correctly check if actual data to render has changed, as opposed to checking if `itemPropsGenerator` had changed.
Test Plan: manual
Reviewers: halla, spang, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3839
Summary:
We recently added a `shouldComponentUpdate` method to ListTabular to
improve scrolling performance. However, this was preventing ListTabular
from updating the selected state of its items when we selected new
threads via cmd or shift keys.
This occurred because instead of passing data as props for each of ListTabular's
items, we are passing a function that calculates the props for each
item, so when we diffed old props and new props in shouldComponentUpdate,
given that the function reference never changes, we thought that the props
hadn't changed and prevented a re render, when in fact the props for each item
generated by that function might actually change.
Unfortunately, we can't use shouldComponentUpdate in this component
given how it is structured
Test Plan: manual
Reviewers: evan, spang, halla
Reviewed By: spang
Differential Revision: https://phab.nylas.com/D3837
Summary:
This is a WIP
Depends on D3799 on billing.nylas.com
This adds a `FeatureUsageStore` which determines whether a feature can be
used or not. It also allows us to record "using" a feature.
Feature Usage is ultimately backed by the Nylas Identity and cached
locally in the Identity object. Since feature usage is attached to the
Nylas Identity, we move the whole Identity object (except for the ID) to
the database.
This includes a migration (with tests!) to move the Nylas Identity from
the config into the Database. We still, however, need the Nylas ID to stay
in the config so it can be synchronously accessed by the /browser process
on bootup when determining what windows to show. It's also convenient to
know what the Nylas ID is by looking at the config. There's logic (with
tests!) to make sure these stay in sync. If you delete the Nylas ID from
the config, it'll be the same as logging you out.
The schema for the feature usage can be found in more detail on D3799. By
the time it reaches Nylas Mail, the Nylas ID object has a `feature_usage`
attribute that has each feature (keyed by the feature name) and
information about the plans attached to it. The schema Nylas Mail sees
looks like:
```
"feature_usage": {
"snooze": {
quota: 10,
peroid: 'monthly',
used_in_period: 8,
feature_limit_name: 'Snooze Group A',
},
}
```
See D3799 for more info about how these are generated.
One final change that's in here is how Stores are loaded. Most of our
core stores are loaded at require time, but now things like the
IdentityStore need to do asynchronous things on activation. In reality
most of our stores do this and it's a miracle it hasn't caused more
problems! Now when stores activate we optionally look for an `activate`
method and `await` for it. This was necessary so downstream classes (like
the Onboarding Store), see a fully initialized IdentityStore by the time
it's time to use them
Test Plan: New tests!
Reviewers: khamidou, juan, halla
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3808
Summary:
We need to wait for the `DraftEditingSession` to set it's draft before we can
pass it to the composer. I've modified these tests to properly wait for the
draft promise. Additionally, I removed the `DraftStore.isSendingDraft()` stub
so we run the actual logic for determing if a draft can be sent. We had some
tests with this stub, but then we had other tests that made sure it worked
without the stub, and I don't see why we don't just run the tests without the
stub to begin with. I added a stub to `@session.ensureCorrectAccount()`
to get around issues with committing the draft's change set.
Test Plan: Ran the suite!
Reviewers: evan, juan
Reviewed By: evan, juan
Differential Revision: https://phab.nylas.com/D3834
Summary:
Previously, when moving to trash or spam, we were not correctly removing
the inbox category. This produced slightly different results because the
generated task was slightly different.
Also, in ChangeMailTask we were removing the locks on the models before
the tasks had actually succeeded-- these locks allowed us to ignore
deltas on those models while the task was in progress, so removing them
before it completed caused threads to flicker when performing actions
This depends on D3829 which also properly addresses
archiving/deleting/moving to spam threads that contain sent messages
Addresses T7757 and #2706
Test Plan: unit
Reviewers: evan, halla, spang
Reviewed By: evan, halla, spang
Differential Revision: https://phab.nylas.com/D3830
Summary: This is a pretty small diff – it changes the snooze-store to save metadata for the individual messages affected instead of for the whole thread. We need this to have snoozing work without running an actual sync of the whole mailbox.
Test Plan: WIP.
Reviewers: evan, halla
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3815
Summary:
We're having some strange issues regarding corruption of the config
settings at runtime. This diff refactors the code to be more
straightforward and to be louder when things don't go as expected.
Test Plan: Run locally
Reviewers: juan, evan
Reviewed By: juan, evan
Differential Revision: https://phab.nylas.com/D3828
Summary: Clean up k2's test database after each spec. Depends on D3826
Test Plan: unit
Reviewers: evan, halla, spang
Reviewed By: halla, spang
Differential Revision: https://phab.nylas.com/D3827
Summary: Just a quick fix to remove the warning in the console
Test Plan: manual
Reviewers: mark
Reviewed By: mark
Differential Revision: https://phab.nylas.com/D3823
Summary: Move config to the database
Test Plan:
Launch app before commit.
Launch on commit.
Confirm all settings and accounts stay the same.
Console.logged progress
Reviewers: mark, halla, spang, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3820
Summary:
Sister diff to D3817
syncState on folders may contain arbitrarily long arrays of UIDs
(particularly, failedUIDs). If we serialize this JSON column to
edgehill.db, we can end up serializing very large objects when
persisting the local task queue. When the queue contains many tasks,
this can balloon the JSON blob to megabytes, causing the main window and
the worker window to become unresponsive.
The UI doesn't need to know about IMAP bookkeeping internals, so
serialize the sync progress instead of the sync state. This has the
advantages that (1) we don't need to worry about future keys added
to the syncState being large and (2) when we add Exchange support
we already have an abstraction for sync progress.
Test Plan: manual
Reviewers: juan, mark, halla
Reviewed By: halla
Differential Revision: https://phab.nylas.com/D3819