Mailspring/spec-nylas/stores
Ben Gotow e094261470 fix(drafts): If a draft disappears during editing, re-save instead of blowing up (Sentry 2844, more.)
Summary:
Previously, if a draft was deleted while a DraftChangeSet had uncommitted changes, it would blow up trying to find the draft.

This is bad, and can happen in normal scenarios. There are several changes in this diff:

- The DraftChangeSet no longer retrieves the draft from the database before saving changes. Instead, the save logic is in the DraftStoreProxy which already has a version of the draft kept fresh by a subscription to the DraftStore.

- The SyncbackDraftTask already had logic for POSTing when a PUT to a draft returns a 404, so no new logic was necessary there. THe new "commit" logic causes us to put back the draft that was lost, and then when we save it we detatch it from it's serverId and re-save.

In manual testing, this transparently handles the case where you delete a draft from Gmail while editing it.

Test Plan: I've added 22 tests for the DraftChangeSet and DraftStoreProxy

Reviewers: dillon, evan

Reviewed By: dillon, evan

Differential Revision: https://phab.nylas.com/D2012
2015-09-14 11:30:16 -07:00
..
account-store-spec.coffee feat(accounts): Kill namespaces, long live accounts 2015-08-21 15:29:58 -07:00
contact-store-spec.coffee fix(regex): allow "=" in valid email address 2015-08-31 15:48:39 -07:00
database-setup-query-builder-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
database-store-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
draft-store-proxy-spec.coffee fix(drafts): If a draft disappears during editing, re-save instead of blowing up (Sentry 2844, more.) 2015-09-14 11:30:16 -07:00
draft-store-spec.coffee fix(draft): fix popout draft error & add tests 2015-09-06 14:55:06 -07:00
event-store-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
file-download-store-spec.coffee fix(spec): Stub correct method 2015-08-28 16:37:09 -04:00
file-upload-store-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
focused-contacts-store-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
focused-content-store-spec.coffee fix(perf): Apply accountId to more queries, always run query plans in dev mode to flag SCANs 2015-08-26 14:10:28 -07:00
focused-mail-view-store-spec.coffee fix(search): fix UI issues with search and add test 2015-09-09 16:04:13 -07:00
message-store-spec.coffee fix(perf): Apply accountId to more queries, always run query plans in dev mode to flag SCANs 2015-08-26 14:10:28 -07:00
metadata-store-spec.coffee fix(naming): Move atom/inbox/nilas refs to Nylas 2015-05-15 11:07:28 -07:00
task-queue-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
unread-count-store-spec.coffee refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00