Commit graph

1296 commits

Author SHA1 Message Date
Ben Gotow 95d2f3ae94 Initial sync process management 2017-07-04 16:00:54 -07:00
Ben Gotow 113665e730 Move nylasID back to config 2017-07-03 23:50:37 -07:00
Ben Gotow df249b75f6 Remove concept of local sync tokens 2017-07-03 23:49:04 -07:00
Ben Gotow 57c5c5b28c Start connecting C++ process to onboarding flow 2017-07-03 11:44:28 -07:00
Ben Gotow 40eca53dbc Reimplement DestroyCategoryTask in C++ 2017-06-29 15:20:02 -07:00
Ben Gotow 44957a654d Reimplement SyncbackCategoryTask in C++, need error handling 2017-06-29 00:41:07 -07:00
Ben Gotow 232bff4cbc Remove use of abstract base class Category in specs 2017-06-28 23:48:45 -07:00
Ben Gotow f7f345baf9 Fix display of labels vs. folders in the sidebar 2017-06-28 23:01:45 -07:00
Ben Gotow 73b7fe5553 Rename FileDownloadStore => AttachmentStore 2017-06-28 22:45:15 -07:00
Ben Gotow 2dce6fcb6a Fix drag from label to label not removing origin label 2017-06-28 22:42:29 -07:00
Ben Gotow 72a4cbd3dd Allow more flexible coersion from int to bool to fix unread perspective 2017-06-28 22:42:11 -07:00
Ben Gotow c84a6fd957 Fix display of hidden messages in spam / trash 2017-06-28 18:15:17 -07:00
Ben Gotow b65d86ae5e Merge FileUploadStore and FileDownloadStore, draft.uploads and draft.files 2017-06-28 17:40:21 -07:00
Ben Gotow 9ed627f6b0 Remove PerformSendActionTask in favor of immediate local execution 2017-06-28 13:59:50 -07:00
Ben Gotow 11f19ae648 Fix file attachments / FileUploadStore 2017-06-28 13:37:33 -07:00
Ben Gotow 1c64221c12 Remove the loading screen 2017-06-28 13:26:52 -07:00
Ben Gotow f74fd8324d Remove concept of “account.organizationUnit” since Gmail has folders also 2017-06-27 11:39:43 -07:00
Ben Gotow f6340d5555 Remove DeltaProcessor, JS side will not write to database 2017-06-27 11:34:20 -07:00
Ben Gotow efbea58e1e Overhaul TaskFactory.tasksForApplyingCategories, fix many specs 2017-06-27 11:31:22 -07:00
Ben Gotow 1e5abf65dc Make contact sidebar use search API, not ThreadContact join table 2017-06-26 23:55:20 -07:00
Ben Gotow 6cbbd0a3dd Shorten JSON keys to save like…100mb of sqlite space 2017-06-26 23:48:55 -07:00
Ben Gotow ade70d32bd Contact ranking now built into sync, remove separate cache 2017-06-25 17:52:29 -07:00
Ben Gotow 38c6ecea00 Limit number of results shown in search dropdown 2017-06-25 16:38:16 -07:00
Ben Gotow 29e7afce51 FTS5 search indexing is moving to c++ 2017-06-25 10:45:13 -07:00
Ben Gotow ddb7d8d793 react-addons-test-utils => react-dom/test-utils 2017-06-25 01:24:25 -07:00
Ben Gotow bd9983005c Remove deprecations still supported by client 2017-06-25 01:06:54 -07:00
Ben Gotow 555681546d Fix remaining references to draftId => headerMessageId 2017-06-25 00:59:16 -07:00
Ben Gotow 4966ae3650 Draft creation, saving, deletion moved to c++ 2017-06-25 00:46:01 -07:00
Ben Gotow 3c56e2fbfd Remove isomorphic-core and related packages 2017-06-24 20:34:01 -07:00
Ben Gotow d53606922f Remove Attributes.ServerId 2017-06-24 20:03:35 -07:00
Ben Gotow ab0908b263 Cleanup 2017-06-24 19:58:19 -07:00
Ben Gotow f038c97144 Move thread counts logic to c++ 2017-06-24 18:40:41 -07:00
Ben Gotow f37aa13780 Fix double fromJSON issue 2017-06-24 12:16:05 -07:00
Ben Gotow 0bec5719fd Fetch messages on demand 2017-06-24 02:28:13 -07:00
Ben Gotow 07428a1060 Remove keybase plugin 2017-06-23 18:23:12 -07:00
Ben Gotow 9977c566df Add fonts and sounds for now 2017-06-23 18:22:51 -07:00
Ben Gotow 07f838bfc9 Get rid of more code 2017-06-23 18:12:28 -07:00
Ben Gotow 2d1ce345c3 Get rid of more code no longer needed 2017-06-23 18:08:46 -07:00
Ben Gotow 6aa666837e Break apart category picker into labels vs folders 2017-06-23 18:01:14 -07:00
Ben Gotow a9a57de215 Remove more perf and timing stuff 2017-06-23 16:30:28 -07:00
Ben Gotow 799ccce640 Revert "[client-app] Measure and report inline composer open times + consolidate timers"
This reverts commit f467664bde.

# Conflicts:
#	packages/client-app/src/flux/stores/draft-store.es6
2017-06-23 16:21:28 -07:00
Ben Gotow 2d423eeac3 Revert "[client-app] Measure and report search perf metrics"
This reverts commit aeddc92e8e.

# Conflicts:
#	packages/client-app/internal_packages/thread-search/lib/search-query-subscription.es6
2017-06-23 16:19:55 -07:00
Ben Gotow e5a310ab3e Revert "[client-app] Measure and report app boot time"
This reverts commit 7cd5128db4.

# Conflicts:
#	packages/client-app/internal_packages/onboarding/lib/onboarding-root.jsx
#	packages/client-app/internal_packages/thread-list/lib/thread-list.cjsx
#	packages/client-app/src/browser/application.es6
2017-06-23 16:18:01 -07:00
Ben Gotow 63abbd582c Revert "[client-app] Measure and record times for opening account windows"
This reverts commit feda238d9c.

# Conflicts:
#	packages/client-app/internal_packages/onboarding/lib/onboarding-root.jsx
#	packages/client-app/src/browser/application.es6
2017-06-23 16:17:09 -07:00
Ben Gotow 08d8326ca4 Revert "[client-app] Measure and report composer window open times"
This reverts commit ecf3709669.

# Conflicts:
#	packages/client-app/internal_packages/composer/lib/main.jsx
#	packages/client-app/src/flux/stores/draft-store.es6
2017-06-23 16:16:30 -07:00
Ben Gotow ff4b8b5eb4 Revert "[client-app] Measure and report sending times"
This reverts commit ae9aede300.

# Conflicts:
#	packages/client-app/src/flux/tasks/send-draft-task.es6
2017-06-23 16:12:37 -07:00
Ben Gotow 8288461302 Revert "[client-app] Measure and report time to select and load a thread"
This reverts commit 4c57fcfab4.

# Conflicts:
#	packages/client-app/internal_packages/message-list/lib/message-list.cjsx
2017-06-23 16:12:20 -07:00
Ben Gotow e2f27c3287 Revert "[client-app] Measure and report times for trashing and marking as spam"
This reverts commit 19195e9686.

# Conflicts:
#	packages/client-app/src/flux/actions.es6
#	packages/client-app/src/flux/stores/thread-list-actions-store.es6
2017-06-23 16:11:53 -07:00
Ben Gotow 4540ae1cc6 Revert "[client-app] Measure and report times for removing labels from threads"
This reverts commit 6dbbf1e094.

# Conflicts:
#	packages/client-app/src/flux/actions.es6
#	packages/client-app/src/flux/stores/thread-list-actions-store.es6
2017-06-23 16:11:42 -07:00
Ben Gotow 1642b53c98 Revert "[client-app]: Measure and report time when dragging threads to sidebar"
This reverts commit fb85db0964.

# Conflicts:
#	packages/client-app/internal_packages/account-sidebar/lib/sidebar-item.coffee
#	packages/client-app/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx
#	packages/client-app/src/flux/actions.es6
#	packages/client-app/src/flux/stores/thread-list-actions-store.es6
2017-06-23 16:11:17 -07:00
Ben Gotow 8348bb210c Revert "[client-app] Measure and report times for removing from inbox"
This reverts commit 90e49d31aa.

# Conflicts:
#	packages/client-app/src/flux/actions.es6
#	packages/client-app/src/flux/stores/thread-list-actions-store.es6
2017-06-23 16:10:15 -07:00
Ben Gotow ef9a1b1164 Revert "[client-app] Measure and report archiving times"
This reverts commit a8fbcb0c93.

# Conflicts:
#	packages/client-app/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx
#	packages/client-app/internal_packages/thread-list/lib/thread-list.cjsx
#	packages/client-app/src/flux/actions.es6
#	packages/client-app/src/flux/stores/thread-list-actions-store.es6
#	packages/client-app/src/global/nylas-exports.es6
#	packages/isomorphic-core/src/metrics-reporter.es6
2017-06-23 16:09:29 -07:00
Ben Gotow 0f6fdb4256 Fuck it - tasks don’t performLocal either 2017-06-23 14:57:52 -07:00
Ben Gotow 6d7fe519d9 Remove all database setup from JS app 2017-06-22 15:41:40 -07:00
Ben Gotow 5065ddcf7b Get rid of message bodies => files change, might put it back sometime, but really just download fewer 2017-06-22 15:41:30 -07:00
Ben Gotow d4d6086636 Remove SetupQueryBuilder - CPP helper will build / migrate database 2017-06-22 15:13:25 -07:00
Ben Gotow b01f8c485e Remove performRemotes, rip apart TaskQueue 2017-06-22 15:07:04 -07:00
Ben Gotow af1de37b36 Remote worker-ui 2017-06-22 13:38:44 -07:00
Ben Gotow 973a411145 Remote client-sync 2017-06-22 13:37:29 -07:00
Ben Gotow 8076fa5c36 Finish Category => Folder Label, still use single relation table 2017-06-22 02:37:10 -07:00
Ben Gotow 73f82ec079 Remove Category concept, part 1 2017-06-21 15:16:48 -07:00
Ben Gotow 1219182b0a Remove clientId, serverId concept 2017-06-21 13:12:49 -07:00
Ben Gotow 48fbe1fbac Remove work window, connect to CPP 2017-06-20 00:33:18 -07:00
Ben Gotow a5afcf17ee bump(version): React 15.6, Electron 1.7.3 2017-06-19 19:12:10 -07:00
Juan Tejada 93abaec09a Merge remote-tracking branch 'private/for-merging' 2017-04-17 22:43:25 -07:00
Juan Tejada d407699a44 [client-sync] Correctly pass path when processing bodies
Summary: see title

Test Plan: manual

Reviewers: mark

Differential Revision: https://phab.nylas.com/D4447
2017-04-17 22:41:51 -07:00
Juan Tejada 5c397f5f7a Merge remote-tracking branch 'private/for-merging' into merge-private 2017-04-17 22:02:29 -07:00
Mark Hahnenberg 8d21d89f0a [client-app, client-sync] Move messages out of db into compressed flat files
Summary:
Previously we stored message bodies uncompressed inside two different
databases. This was bad for a few reasons:

* Duplicate data in multiple places is an obvious waste of disk space
* Uncompressed data also made the disk footprint bigger than it might
  otherwise be
* Storing these large message bodies in the database made the db file
  larger than it otherwise could have been, increasing the size of
  tables and slowing down queries.

This diff adds support for storing message bodies outside of the
database in compressed flat files. It changes the use of the body column
in the K2 database and the MessageBody table in the edgehill database to
contain a blob of JSON that contains a path to the file on disk. We
use the new format in an incremental fashion without having to perform an
actual database migration by first checking if the body matches our expected
JSON format and treating it appropriately if it doesn't. Both databases refer
to the same file on disk, thus deduplicating the messages bodies. We also
transparently support gzipping the message bodies stored on disk when we
read from/write to the files. The real world space savings depends on the
compressibility of the messages, but we've seen up to ~60% improvement in disk
space usage for certain inboxes. Typical savings are closer to 20%. Also, by
storing messages as separate files on disk we can potentially integrate with
Spotlight search at some point in the future.

Test Plan:
Run locally, make sure that upgrade to this doesn't hose things,
look at size of DB, read emails

Reviewers: evan, spang, halla, juan

Reviewed By: halla, juan

Differential Revision: https://phab.nylas.com/D4422
2017-04-17 22:00:32 -07:00
Juan Tejada be5c3d27e5 Merge private repo 2017-04-17 17:17:05 -07:00
Juan Tejada 1f9e2e0886 [client-app] Update changelog 2017-04-17 11:42:00 -07:00
Mark Hahnenberg 92c3d8c608 [client-app] Fix benchmark mode
Summary:
We weren't passing benchmarkMode through in the default window options,
so the worker window (or any other spawned window) would think it wasn't in
benchmark mode.

Test Plan:
Run locally, verify that the worker window thinks it's in
benchmark mode

Reviewers: halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4427
2017-04-17 11:29:02 -07:00
Nylas Coffee Machine 8b9d98c5e2 bump(version): 2.0.15 2017-04-17 10:46:44 -07:00
Juan Tejada 4a25f6388c [client-app] Database malformed errors shouldn't be retryable
Summary:
Given that this error is unrecoverable it shouldn't be retryable.
Additionally, this commit improves error handling for this error in a
few ways:

- Don't delete all databases, just edgehill.db which is the one we know is corrupted. (Use `handleDatabaseUnrecoverableError` instead of `Actions.resetEmailCache`)
- Message the user about the database being reset so the app doesn't restart without notice, and make sure that this message is only displayed once by moving it to the main process

Test Plan: manual

Reviewers: mark, spang, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4433
2017-04-17 10:45:39 -07:00
Juan Tejada ad50fdeaf0 [client-app] When resetting database, make sure to re-init db reader
Summary: see title

Test Plan: manual

Reviewers: halla, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4432
2017-04-17 10:32:08 -07:00
Juan Tejada 26868f6f9b [client-app] Correctly handle db malformed errors in main process
Summary:
This commit addressess issue T8135, which prevents the app from
starting.

This was happening because when 3111c166 landed, we added database
access from the main (backend) electron process to be able to read the
identity now stored in the database: https://github.com/nylas/nylas-mail/commit/3111c166#diff-1efa26fa0ae1603366b2c0033d971028R44
However, we omitted to add any error handling, so if the database failed to open
due to a database malformed error (which it does:
https://sentry.io/nylas/nylas-mail/?query=is%3Aunresolved+release%3A2.0.14+malformed&statsPeriod=14d), the app will just fail to start,
given that this happens during the initialization of the main process.
Additionally, the fact that we had no error handling increased the error
reports for malformed errors given that we would never handle them, so
every-time we opened the app we would report the same error

This commit adds the same error handling we have in the DatabaseStore
and moves the code around so it's available both in the main and
renderer processes.

After this commit, if the database fails to open during main process
initialization, due to malformed errors or others, we will correctly
inform the user that the database is corrupted, rebuild it, and restart
the app.

Test Plan:
manually throw errors during setup, verify that we handle them
correctly

Reviewers: mark, spang, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D4431
2017-04-17 10:30:15 -07:00
Juan Tejada 5b99c56310 [client-app] Remove dead mail rules code
Summary:
Which was arguably already a code smell being inside the
DatabaseStore

Test Plan: manual

Reviewers: mark, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4430
2017-04-17 10:17:34 -07:00
Juan Tejada 2c22d1aea2 [client-app] Update changelog 2017-04-14 13:37:01 -07:00
Juan Tejada f9a7a59bde [client-app] Update changelog 2017-04-14 13:36:31 -07:00
Nylas Coffee Machine 66b9bd1770 bump(version): 2.0.14 2017-04-14 12:25:57 -07:00
Juan Tejada 00aa499365 [client-sync] Prevent duplicate accounts and sync workers
Summary:
After https://github.com/nylas/nylas-mail-all/commit/008cb4c, the shape of
account.connectionSettings changed, which means that ids for accounts
will also change, given that they are based on the connection settings (see
Account.hash()).

This is fine in most cases, except for accounts that were running on a
version of Nylas Mail before 008cb4c, then upgraded to a version
after 008cb4c, and then re-authed their account.
In this scenario, re-authing the account will create a second account with
a different `id` but with the same email address, along with an extra
sequelize database, and will start a second SyncWorker for the same
account. App-side, the `AccountStore` will correctly overwrite the first account,
so users would correctly see just 1 account in the sidebar. However, given
that 2 SyncWorkers would be running for the same account,
message ids would collide in edgehill.db and this would cause
threads to disappear from the ui as if they were being deleted.

To fix this, we need to do 2 things:

- Upon app start, we remove any duplicate accounts that might have been created due to this bug before starting any sync workers
- If we detect that we are going to create a duplicate account upon auth success, we delete the old account first. This will effectively cause sync to restart for the account.

Test Plan:
Verified problem: Checked out a commit before 008cb4c, authed an account, checked out master, re-authed account, verified that duplicate accounts are created.

Then test 2 scenarios:
- With duplicate accounts present, checked out this commit, verified that duplicate account would be removed and sync would function normally.
- With an account authed on a build before 008cb4c, checked out this commit, re-authed the account, and verified that duplicate account wouldn't be created

Reviewers: mark, halla, khamidou, spang

Reviewed By: spang

Subscribers: tomasz

Differential Revision: https://phab.nylas.com/D4425
2017-04-14 12:24:27 -07:00
Juan Tejada 373eb9651b [client-sync] Correctly remove sync worker reference when destroying it
Summary:
By nullifying the key inside `workersByAccountId` we would attempt to
access accountIds that no longer existed in other parts of the code by
using Object.keys()

This makes it so we correctly completely remove the record from the map

Test Plan: manual

Reviewers: halla, spang, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4426
2017-04-14 11:18:23 -07:00
Juan Tejada c6f7a862c9 [client-sync] Init SyncProcessManager with Identity 2017-04-13 21:37:00 -07:00
Mark Hahnenberg b1123433d0 [client-sync] Fix contact ranking error
Summary:
This was showing up in Sentry. Check to see if the recipient has an email
before calling toLowerCase.

Test Plan: yolo

Reviewers: halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4423
2017-04-13 16:45:12 -07:00
Juan Tejada 91f5ca4de9 [client-app] Update changelog 2017-04-13 14:02:24 -07:00
Juan Tejada 9fbee22538 [client-app] Update changelog 2017-04-13 13:27:28 -07:00
Nylas Coffee Machine 1f307f66d8 bump(version): 2.0.13 2017-04-13 12:32:00 -07:00
Juan Tejada fc5583523e [client-app] Upload nupkg with correct name for win32 autoupdater to work
Summary: See title

Test Plan: manual

Reviewers: spang, khamidou, halla

Reviewed By: khamidou, halla

Differential Revision: https://phab.nylas.com/D4421
2017-04-13 12:29:29 -07:00
Juan Tejada 911d75b113 [client-app] Correctly handle window.unhandledrejection events
Summary:
It seems that sometimes we get events that don't have `event.detail.reason`.
This commits tries to make our best guess, or report info about the event shape

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4420
2017-04-13 11:54:27 -07:00
Juan Tejada aa7749dff5 [client-app] Update changelog 2017-04-13 11:25:50 -07:00
Nylas Coffee Machine 94dc4d0a30 bump(version): 2.0.12 2017-04-13 11:09:03 -07:00
Juan Tejada a7b1034dc6 [client-app] Prevent NM from overwriting N1 binary on windows
Summary:
This changes the `name` option we pass to `electron-windows-installer`,
which makes it so that the app is installed under
`AppData\Local\NylasMail` instead of `AppData\Local\Nylas` where the
old N1 binary lives

Test Plan: manually tested the builds from `ci-test-4` branch on the surface machine

Reviewers: mark, spang, khamidou, halla

Reviewed By: khamidou, halla

Differential Revision: https://phab.nylas.com/D4419
2017-04-13 11:07:16 -07:00
Juan Tejada d5a2afd0f6 [client-app] Fix runtime error in FetchFolderList
Summary: See title

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4418
2017-04-13 10:49:08 -07:00
Juan Tejada 9c889c7cff [client-app] Prevent old N1 config from getting wiped when installing Nylas Mail
Summary:
Due to a legacy migration system, users that had previously installed
old N1 (1.5.0) would get their N1 config wiped after installing Nylas
Mail (2.0) in most cases.

See https://github.com/nylas/nylas-mail/blob/n1-pro/src/browser/nylas-pro-migrator.es6 for details

Fixes T8096

Test Plan: manual

Reviewers: halla, spang, mark

Reviewed By: mark

Maniphest Tasks: T8096

Differential Revision: https://phab.nylas.com/D4417
2017-04-12 20:48:40 -07:00
Juan Tejada 664da98c22 [*] Remove useless docs
Summary:
This makes grepping the codebase really painful. We don't need these
docs here

Test Plan: manual

Reviewers: mark halla spang evan

Subscribers:
2017-04-12 19:58:06 -07:00
Juan Tejada e4dcfa40b1 [client-app] Update changelog 2017-04-12 13:12:24 -07:00
Nylas Coffee Machine 3396254499 bump(version): 2.0.11 2017-04-12 12:13:03 -07:00
Mark Hahnenberg 8d4ef160a1 [client-sync] Dispose of mail listener connection before getting new one
Summary:
When we had to refresh our credentials for the mail listener connection we
weren't disposing of the old connection which caused us to slowly leak
connections from the IMAP connection pool, eventually requiring a
restart. Now we always dispose of the connection prior to requesting a
new one from the pool.

Test Plan: Run locally always refreshing credentials, verify we don't get stuck

Reviewers: spang, evan, halla, juan

Reviewed By: halla, juan

Subscribers: halla

Differential Revision: https://phab.nylas.com/D4414
2017-04-12 12:11:49 -07:00
Juan Tejada 811843f880 Revert "[client-sync] Poll for gmail attribute changes from _mailListenerIMAPConn"
This reverts commit 15c3e328fc.

See https://phab.nylas.com/D4410 for details on why it was reverted
2017-04-12 12:08:24 -07:00
Juan Tejada 1bf453dd4a [client-app] Don't double report unhandled rejections
Summary:
We listen for unhandled rejections on both the `process` and the `window`. From
my understanding, both are necessary because some errors might escape
one or the other. However, most errors get caught by both handlers, so
we don't want to double report them to sentry (or the console).

To prevent this, this commit debounces the unhandled rejection handler
for a very short time so that the same error only gets reported once.
Additionally, it rate limits reports to sentry based on the stack trace

Test Plan: manual

Reviewers: mark, halla

Reviewed By: mark, halla

Differential Revision: https://phab.nylas.com/D4413
2017-04-12 12:06:22 -07:00
Juan Tejada b6771ea745 [client-app] Fix unhandled rejection handling (fix ipc parse error)
Summary:
Previously, we were listening for unhanlded rejections on both the
`window` and the `process`. However, the window handler didn't receive
an error as a parameter, but rather a window event. When trying to
report this event and sending it over IPC we would get an ipc parse
error.

This commit makes it so we correctly report the error instead of the
window event.

Test Plan: manual

Reviewers: mark, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D4412
2017-04-12 12:05:07 -07:00