Commit graph

1957 commits

Author SHA1 Message Date
Karim Hamidou
141dd39c13 Create a wrapper around legacy N1 APIs.
Conflicts:
	src/K2
2017-01-09 15:18:43 -08:00
Halla Moore
08a0883d21 fix(spinner): Use a constant spinner when loading inline images
Summary:
We used to use a progress-based spinner, but we never get any progress
updates while downloading files, so the spinner was always at 0 and
never visible.

The submodule-commit is D3609, which adds support for inline images

Test Plan: tested locally

Reviewers: evan, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D3610
2017-01-09 10:46:09 -08:00
Evan Morikawa
df1343da37 feat(off): disable/hide snooze, mail rules, misc minor plugins 2017-01-06 15:39:09 -08:00
Jackie Luo
c0596ef8e4 fix(category-picker): Hide starred label 2017-01-06 13:18:51 -08:00
Tomasz Finc
7cc1666279 fix(Linting errors)
Summary: Second attempt at not linting the error logger and tiny lint cleanup

Test Plan: run the build

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3591
2017-01-05 14:39:25 -08:00
Mark Hahnenberg
f3caf0b561 [thread-search] Fix archiving from search perspective
Summary:
We weren't removing the inbox category in the search perspective, so
things weren't actually being archived.

Test Plan: Run locally

Reviewers: juan, evan

Reviewed By: evan

Maniphest Tasks: T7389

Differential Revision: https://phab.nylas.com/D3575
2017-01-04 11:15:45 -08:00
Halla Moore
9e2f14513e feat(sync-status): Add messaging in other areas when syncing
Summary:
We want users to know that their account is still syncing if they're
looking for a message and end up at the bottom of a thread list.
This diff changes some of the wording around the messaging when
sync isn't complete and also adds a footer at the bottom of the
syncing thread lists. Additionally, we added a "Show Progress"
link that will expand the sync details in the lower left.

Addresses T7354

Test Plan: tested locally

Reviewers: juan, evan, jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3551
2017-01-03 13:27:15 -08:00
Christine Spang
b1aeefe433 fix(sync-worker): Don't call _determineWorkerPool() twice
A race condition on bootup was causing us to sometimes start
two delta sync workers for the same account.
2016-12-22 12:43:45 -08:00
Evan Morikawa
083021d860 perf(delta): replaces API delta stream with direct in-memory one
Summary:
This replaces the API delta stream with a direct in-memory one

Depends on D3548

Test Plan: manual

Reviewers: halla, jackie

Reviewed By: halla, jackie

Subscribers: juan

Differential Revision: https://phab.nylas.com/D3549
2016-12-21 18:44:17 -08:00
Juan Tejada
a0050a22d5 fix(sync-status):Use weighted percentage avg for sync status progress bar
Summary: Also move calculation to sync store, rename stuff a little bit

Test Plan: Manual :(

Reviewers: evan, jackie, halla

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3547
2016-12-21 18:30:54 -05:00
Jackie Luo
b5970e1e46 fix(initial-sync-activity): Update correct function name 2016-12-21 12:04:50 -08:00
Juan Tejada
b29f46fdae fix(auth): Fix authentication notifications
Summary:
Depends on D3544 (K2 diff)

This commit ensures that auth notifications are showed when the
underlying sync worker fails and are cleared when an account is
successfully reconnected

To achieve this, we manually keep track and update syncStates where
appropriate via `Actions.updateAccount`, given that we have access to
N1's version of the account directly from local-sync.
Initially I was considering account delta stream to the cloud-api and the local-api, but that
just complicated things more than it helped.

This commit also fixes a bug with refreshing the gmail token in which we
we were only attempting a token refresh upon restarting the app

This addresses: T7346, T7305, T7335

Test Plan: Manual

Reviewers: halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3545
2016-12-21 07:23:09 -05:00
Halla Moore
78d1b85c7f re-feat(initial-sync-status): Bring the intiial sync progress bar back
Summary:
Adds a UI component to see the progress of initial sync.
(The behavior is sometimes a little strange, but I believe this is
just because of weird behavior in the NylasSyncStatusStore itself.
For instance, it sometimes never populates the `folderSyncProgress`
fields, or it never sets the progress to 1, so the bar stops at 99%)

Test Plan: tested locally

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3536
2016-12-19 12:40:36 -08:00
Evan Morikawa
bbaf4590af feat(auth): update onboarding helpers to be async 2016-12-18 23:38:34 -05:00
Evan Morikawa
31a8fb2b5b feat(auth): add office 365 support
Summary: Adds a new button in auth for native Office 365 support

Test Plan: manual

Reviewers: jackie, halla, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3532
2016-12-16 16:53:46 -05:00
Karim Hamidou
cb6f761df3 Required changes for refreshing access tokens. 2016-12-16 11:10:20 -08:00
Halla Moore
d03049b403 fix(mail-rules): use the right field name to get an account id
Summary:
With the fix to the delta-processor, this is all that's needed to
get mail rules working! Some places were trying to use 'accountId'
to access an account object's id, but it needs to be 'id' instead.

Test Plan: tested locally

Reviewers: jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3525
2016-12-15 14:18:50 -08:00
Evan Morikawa
99b428f90c fix(import): require 'rx' from 'nylas-exports' 2016-12-15 15:32:47 -05:00
Halla Moore
9066078911 fix(delta-processor): Return created models in the expected format
Summary:
We were returning an array of arrays, when really we wanted an object
of arrays keyed by model type. This also involved removing an implementation
of mapObject that was overwriting underscore's implementation of it.

Test Plan: local, having others try it.

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3509
2016-12-15 12:12:37 -08:00
Juan Tejada
9039c49dba fix(send/tasks): Fix deltas for SyncbackRequest SyncbackTaskAPIRequest
Summary:
This commit fixes processing deltas for `ProviderSyncbackRequests` and
resolution of the `SyncbackTaskAPIRequest`

Specifically:
- Fix and update field definitions for `ProviderSyncbackRequest`
- Correctly parse the error attached to any `ProviderSyncbackRequest`
- Correctly process deltas for `ProviderSyncbackRequests` inside the
delta-processor
- Fix any tasks that used `SyncbackTaskAPIRequest`, and update send to use those

Depends on D3510

Test Plan: Todo/Manual

Reviewers: jackie, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D3511
2016-12-15 11:57:14 -08:00
Juan Tejada
d92506d8f1 fix(sync-status): Change old per model status, in favor of per folder
Summary:
Addresses T7275
Previously, we kept track of the sync status of each API model, and the progress
we'd made syncing all available models (e.g. all threads, messages, events, etc)

Given K2's set up, we are now keeping track of sync status per folder, i.e. what
percent of the folder's messages we've synced. This status is now reported from K2
to N1 via folder object deltas, and this commit rewrites the
NylasSyncStatusStore (in ES6) to reflect that.

The new Store keeps the sync state per account, which is the merged state of
per folder sync state, and delta connections state.
We also got rid of `CategoryStore.whenCategoriesReady` in favor of
`whenCategoryListSynced`, which is derived from the fact hat as long as we've
started syncing one folder, we've already synced the entire list of of folders/labels.

There are a couple of TODOs to be addressed in upcoming diffs:
- T7329 Restore the sidebar component to show sync progress, which was previously removed
- T7330 Figure out how to report sync progress per label, specifically, we are interested in knowing how much of the inbox we've synced, which is a label in Gmail. (This might be a non-issue if we sync the inbox very fast, first)

Depends on D3514

Test Plan: Manual

Reviewers: mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3515
2016-12-15 11:17:20 -08:00
Evan Morikawa
d1c587a01c fix(spec): add support for async specs and disable misbehaving ones
More spec fixes

replace process.nextTick with setTimeout(fn, 0) for specs

Also added an unspy in the afterEach

Temporarily disable specs

fix(spec): start fixing specs

Summary:
This is the WIP fix to our spec runner.

Several tests have been completely commented out that will require
substantially more work to fix. These have been added to our sprint
backlog.

Other tests have been fixed to update to new APIs or to deal with genuine
bugs that were introduced without our knowing!

The most common non-trivial change relates to observing the `NylasAPI` and
`NylasAPIRequest`. We used to observe the arguments to `makeRequest`.
Unfortunately `NylasAPIRequest.run` is argumentless. Instead you can do:
`NylasAPIRequest.prototype.run.mostRecentCall.object.options` to get the
`options` passed into the object. the `.object` property grabs the context
of the spy when it was last called.

Fixing these tests uncovered several concerning issues with our test
runner. I spent a while tracking down why our participant-text-field-spec
was failling every so often. I chose that spec because it was the first
spec to likely fail, thereby requiring looking at the least number of
preceding files. I tried binary searching, turning on and off, several
files beforehand only to realize that the failure rate was not determined
by a particular preceding test, but rather the existing and quantity of
preceding tests, AND the number of console.log statements I had. There is
some processor-dependent race condition going on that needs further
investigation.

I also discovered an issue with the file-download-spec. We were getting
errors about it accessing a file, which was very suspicious given the code
stubs out all fs access. This was caused due to a spec that called an
async function outside ot a `waitsForPromise` block or a `waitsFor` block.
The test completed, the spies were cleaned up, but the downstream async
chain was still running. By the time the async chain finished the runner
was already working on the next spec and the spies had been restored
(causing the real fs access to run).

Juan had an idea to kill the specs once one fails to prevent cascading
failures. I'll implement this in the next diff update

Test Plan: npm test

Reviewers: juan, halla, jackie

Differential Revision: https://phab.nylas.com/D3501

Disable other specs

Disable more broken specs

All specs turned off till passing state

Use async-safe versions of spec functions

Add async test spec

Remove unused package code

Remove canary spec
2016-12-15 13:02:00 -05:00
Halla Moore
ace6cf4c9e feat(showDetails): Allow a "Show Details" option on error dialogs
Summary:
Pass in more details on sending errors, so that they can be viewed
more easily by clicking "Show Details", rather than having to check
the worker window console.

Test Plan: tested locally

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3505
2016-12-14 13:02:18 -08:00
Evan Morikawa
476bbb0e5f feat(auth): add better error state handling 2016-12-07 10:11:22 -08:00
Evan Morikawa
f170d14b8d fix(errors): properly rethrow api error 2016-12-06 17:21:37 -08:00
Evan Morikawa
e595590a9a refactor(auth): DRY auth 2016-12-06 16:03:42 -08:00
Juan Tejada
68e596bdf4 [local-sync] Correctly sync folders and labels
This commit will correctly keep track of folder and label ids when
creating them from N1.

Previously, when we sent the request to create a folder or label to our api,
we would immediately get back a serverId because it was created optimistically
in the back end— given that K2 is strictly non-optimistic, we won’t have a serverId
until some undetermined time in the future, and we need to somehow reference
the object that /was/ optimistically created in N1 to update the ui when
we do get the server id.

Since we can deterministically generate ids for folders and labels,
we "guess" what its going to be, and include it in the props of the syncback request
returned to N1. This is the simplest solution to get thing working
correctly right now, but we’ll need to revisit this in the future for
other types of objects (drafts, contacts, events), and revisit how we
will manage optimistic updates in N1 when we merge the 2 codebases
with K2 (given that K2 was designed to be non-optimisitc).
2016-12-05 18:57:13 -08:00
Ben Gotow
b0b231094d fix(deltas): Minor tweaks to metadata delta processing 2016-12-05 10:19:37 -08:00
Ben Gotow
a9ccd7370c fix(deltas): Minor adjustments for thread deltas 2016-12-02 15:59:05 -08:00
Jackie Luo
ad5a1a6316 refactor(nylas-api): Make requests with helpers 2016-12-02 15:51:38 -08:00
Ben Gotow
0e8829b929 fix linter errors 2016-12-02 15:44:52 -08:00
Evan Morikawa
1f63680fd1 refactor(plugins): use plugin name instead of appId 2016-12-02 17:34:42 -05:00
Christine Spang
a1a85e04be feat(metadata): Look up local thread IDs via message table when setting metadata
Since message IDs are now static but there's no good way to generate
static thread IDs while syncing an account from newest message first,
we give threads the ID of any message on that thread and, when setting
metadata, look up the local thread ID by first going through the
message table.
2016-12-02 14:13:58 -08:00
Evan Morikawa
fcb36abbe8 fix(account): Remove unsupported account types 2016-12-02 16:44:44 -05:00
Evan Morikawa
2b2c998dee feat(sync): let N1 be aware of provider synback requests 2016-12-02 16:15:17 -05:00
Evan Morikawa
cee7d05017 debug(delta): add logs 2016-12-02 15:11:48 -05:00
Evan Morikawa
cfc605136b refactor(sync): sync workers only use delta syncs now 2016-12-02 14:48:56 -05:00
Ben Gotow
fb13abe8f4 fix(deltas): Process all deltas of each class in a single pass
Also changed the DeltaProcessor so it doesn’t query for models before sending out `Actions.didPassivelyReceiveCreateDeltas`, and renames it to be more clear it’s about deltas.
2016-12-02 11:41:49 -08:00
Ben Gotow
e3b4fc859e fix(deltas): Remove extra params passed to streaming endpoint 2016-12-01 18:42:13 -08:00
Ben Gotow
6d85a8ef81 lint(*): Fix linter errors within K2, update eslint grunt task 2016-12-01 15:38:16 -08:00
Evan Morikawa
00832b5a83 fix(auth): now authing IMAP through n1-cloud 2016-12-01 16:56:02 -05:00
Evan Morikawa
2ee11006e9 feat(auth): IMAP request to both n1-cloud and local sync 2016-12-01 16:56:02 -05:00
Ben Gotow
6fb08f55c5 fix(accounts): Save both local and cloud tokens per account 2016-12-01 13:35:20 -08:00
Evan Morikawa
77799519e4 fix(spec): fixed specs for nylas-sync-worker 2016-12-01 14:00:20 -05:00
Evan Morikawa
278a4d16d4 fix(spec): progress on spec fixes for sync worker 2016-12-01 13:17:55 -05:00
Juan Tejada
d409a5a3f9 fix(delats): Warn when receiving unkown obejct class 2016-12-01 09:14:02 -08:00
Evan Morikawa
380f370e7d fix(sync): Support N1Cloud auth errors. Fix LongConnection cleanup 2016-12-01 12:04:37 -05:00
Evan Morikawa
58874e8ad3 fix(delta): JSON blob persist failed to save properly 2016-12-01 11:04:19 -05:00
Ben Gotow
ed74e454d2 fix(deltas): Fix deltaProcessor handling deletes wrong 2016-11-30 17:00:11 -08:00
Ben Gotow
daed7146b5 fix(deltas): Delta.id is now a transaction id, need objectId 2016-11-30 16:53:52 -08:00