Mailspring/internal_packages/thread-list/lib
Evan Morikawa 395bd80da2 fix(draft-list): draft list removes draft when the message sends
Summary:
This started when I noticed that drafts weren't dissapearing from the
draft list after send. This was a pretty big bug because if you ever
clicked on one again and tried to re-send it would throw a 400 error
saying the draft id doesn't exist.

This uncovered a few fundamental issues with the DB.

First of all, the reason the draft list wasn't updating was because the DB
trigger that happened when we got in a new message, was being ignored
since the diff contained no drafts (it's now a message).

The bigger issue was that if you had a draft with only a clientId, gave it
a serverId, and tried to call "save", the REPLACE INTO method would not
update the old object, but rather create a second duplicate. This is
because the `id` field was being used as the PRIMARY KEY, and in this
case, that `id` field changed! The fix was to change the PRIMARY KEY to be
the `cilent_id` instead of the `id` and use that as the REPLACE INTO
index.

We still need the `id` field; however, because all of our reads depend on
that field usually being the serverId

Fixes T3507

Test Plan: See new and updated tests

Reviewers: dillon, bengotow

Reviewed By: bengotow

Maniphest Tasks: T3507

Differential Revision: https://phab.nylas.com/D1992
2015-09-08 13:11:34 -07:00
..
draft-buttons.cjsx fix(draft-list): draft list removes draft when the message sends 2015-09-08 13:11:34 -07:00
draft-list-sidebar-item.cjsx fix(draft-list-sidebar-item): draft count renders correctly. fixes T3480. 2015-09-01 12:32:39 -07:00
draft-list-store.coffee fix(draft-list): draft list removes draft when the message sends 2015-09-08 13:11:34 -07:00
draft-list.cjsx refactor(db): change ID system to have clientIDs and serverIDs 2015-08-28 11:24:29 -07:00
draft-selection-bar.cjsx Delete button now appears when drafts are selected 2015-07-09 13:28:02 -07:00
empty-state.cjsx feat(work): Create the "Work" window, move TaskQueue, Nylas sync workers 2015-08-27 16:39:40 -07:00
formatting-utils.cjsx feat(draft-list) Refactor thread-list, create draft-list 2015-03-09 18:25:53 -07:00
main.cjsx feat(accounts): Kill namespaces, long live accounts 2015-08-21 15:29:58 -07:00
thread-buttons.cjsx fix(styles): fix button padding and styles 2015-07-23 12:22:27 -07:00
thread-list-icon.cjsx feat(important): Improtant flags you can enable optionally for Gmail accounts 2015-09-08 10:53:07 -07:00
thread-list-participants.cjsx fix(thread): fix bug whereby thread list blows up if no "from" 2015-08-20 16:21:47 -07:00
thread-list-quick-actions.cjsx feat(accounts): Kill namespaces, long live accounts 2015-08-21 15:29:58 -07:00
thread-list-store.coffee fix(search): Fix for broken search display 2015-09-04 15:31:03 -07:00
thread-list.cjsx feat(important): Improtant flags you can enable optionally for Gmail accounts 2015-09-08 10:53:07 -07:00
thread-selection-bar.cjsx fix(naming): Move atom/inbox/nilas refs to Nylas 2015-05-15 11:07:28 -07:00