Summary:
Adding serialzable registry
Added DatabaseObjectRegistry
rename modelReviver to deserializeObject
Consolidate deserizlie
Get rid of model methods from Utils
DatabaseRegistry change notifications
Logic to throttle database refresh requests
Fixes in nylas-exports
Silent model setup
Continue to resolving the database setup phase for non main windows.
A packages `activate` method does not actually get called until the
DatabaseStore says that it's ready. This is necessary to ensure that a
package that introduces database changes has those schema changes take
hold before the activate happens.
However, in windows like the `onboarding` window that do not depend on a
database at all, there is no setup that is run and the promise use to
never resolve thereby making the packages never activate.
In this case, any external windows will go ahead and let their packages
activate.
Check subclass instead of instance!
Use the correct types for "messages" and "drafts"
Move Salesforce models
Proper references to Model and Attributes
Convert Salesforce stores to NylasStores and fix paths
Move database setup to DB
Test Plan: todo
Reviewers: bengotow
Reviewed By: bengotow
Differential Revision: https://phab.nylas.com/D1899
Summary:
Cancelling a file upload properly makes the task return Task.Status.Finished (previously it was broken and returning Task.Status.Retry)
Dragging a directory now gives you a nice error message
Aborting an upload now looks for the task with the given ID, not a task with the given filepath since there could be identical uploads happening in other windows
Make it more explicit that the uploadId is not the task ID
Add a few tests
Test Plan: Run new tests
Reviewers: evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1750
Summary:
This diff does a couple things:
- Undo redo with a new undo/redo store that maintains it's own queue of undo/redo tasks. This queue is separate from the TaskQueue because not all tasks should be considered for undo history! Right now just the AddRemoveTagsTask is undoable.
- NylasAPI.makeRequest now returns a promise which resolves with the result or rejects with an error. For things that still need them, there's still `success` and `error` callbacks. I also added `started:(req) ->` which allows you to get the underlying request.
- Aborting a NylasAPI request now makes it call it's error callback / promise reject.
- You can now run code after perform local has completed using this syntax:
```
task = new AddRemoveTagsTask(focused, ['archive'], ['inbox'])
task.waitForPerformLocal().then ->
Actions.setFocus(collection: 'thread', item: nextFocus)
Actions.setCursorPosition(collection: 'thread', item: nextKeyboard)
Actions.queueTask(task)
```
- In specs, you can now use `advanceClock` to get through a Promise.then/catch/finally. Turns out it was using something low level and not using setTimeout(0).
- The TaskQueue uses promises better and defers a lot of the complexity around queueState for performLocal/performRemote to a task subclass called APITask. APITask implements "perform" and breaks it into "performLocal" and "performRemote".
- All tasks either resolve or reject. They're always removed from the queue, unless they resolve with Task.Status.Retry, which means they internally did a .catch (err) => Promise.resolve(Task.Status.Retry) and they want to be run again later.
- API tasks retry until they succeed or receive a NylasAPI.PermanentErrorCode (400,404,500), in which case they revert and finish.
- The AddRemoveTags Task can now take more than one thread! This is super cool because you can undo/redo a bulk action and also because we'll probably have a bulk tag modification API endpoint soon.
Getting undo / redo working revealed that the thread versioning system we built isn't working because the server was incrementing things by more than 1 at a time. Now we count the number of unresolved "optimistic" changes we've made to a given model, and only accept the server's version of it once the number of optimistic changes is back at zero.
Known Issues:
- AddRemoveTagsTasks aren't dependent on each other, so if you (undo/redo x lots) and then come back online, all the tasks try to add / remove all the tags at the same time. To fix this we can either allow the tasks to be merged together into a minimal set or make them block on each other.
- When Offline, you still get errors in the console for GET requests. Need to catch these and display an offline status bar.
- The metadata tasks haven't been updated yet to the new API. Wanted to get it reviewed first!
Test Plan: All the tests still pass!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D1694
Summary:
Fixes: T1334
remove final InboxApp references
move out all underscore-plus methods
Mass find and replace of underscore-plus
sed -i '' -- 's/underscore-plus/underscore/g' **/*.coffee
sed -i '' -- 's/underscore-plus/underscore/g' **/*.cjsx
Test Plan: edgehill --test
Reviewers: bengotow
Reviewed By: bengotow
Differential Revision: https://phab.nylas.com/D1534
Summary:
This is an effort to make the logic around the process of sending a draft
cleaner and easier to understand.
Fixes T1253
Test Plan: edgehill --test
Reviewers: bengotow
Reviewed By: bengotow
Maniphest Tasks: T1253
Differential Revision: https://phab.nylas.com/D1518