Summary:
- Now behaves exactly like in Gmail:
- If viewing inbox, it will archive or trash, depending on setting
- If viewing starred, will unstar
- If viewing trash, will move to inbox
- If viewing label, will remove label (no folder support)
- No op otherwise
- Updates TaskFactory helpers and adds some helper methods
- Updates specs
Test Plan: - Manual
Reviewers: evan, bengotow
Reviewed By: bengotow
Differential Revision: https://phab.nylas.com/D2492
Summary:
This implements EditableList re-ordering via a new prop callback.
You can drag and drop items in the mail rules list and the accounts list.
Note that you can't drag between lists - right now this is just to enable
re-ordering.
Test Plan: No new specs yet
Reviewers: evan, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D2495
- This fixes unresponsive draft items in the draft list, i.e. draft
windows would not reopen after opening them the first time.
- The `beforeunload` handler will no longer hide a window before its
actually closed. To reduce visible latency when closing, we moved
saving window state to the `unload` event handler.
- Before unload was hiding the window before actually closing it. A
hidden window causes chromium to throttle its renderer process for
performance, even though `pageVisibility` was set to true (see
https://github.com/atom/electron/issues/3225 for more detils).
NylasEnv.finishUnload is used in this context: When a `beforeunload`
callback prevents the window from closing, it can close it at some point
in the future using finishUnload. NylasEnv.finishUnload uses _.defer to make
sure we don't call `close` inside the `beforeunload` call stack so the
window doesn't go crazy.
However, since _.defer was being called in the renderer process of a
hidden window, the deferred callback execution could end up delayed by
a second or more, which effectively delayed closing the window by a
second.
If we tried to reopen a window with the same window props, e.g. a
draft window, before it was actually closed, the app would go crazy
and wouldn't open it.
So now we just don't hide windows on beforeunload
In general, we call the functions in AccountStore and CategoryStore / constantly / and inside of critical places like thread list render. Would be nice to create a safe and generic way of caching things and invalidating them when data changes.
- Since Thread#labels and Thread#folders are now aliased to
Thread#categories, Thread#fromJSON had to populate the categories array
correctly. However it, was only being populated from json if the
categories array was undefined, which prevented the categories from
being populated when API updates were received.