Mailspring/spec-nylas
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
..
components
fixtures fix(quoted): if whole message is quoted text, then show it 2015-09-02 18:26:58 -07:00
models fix(thread): thread.sortLabels() now ignores 'Sent Mail' and other unnecessary labels. fixes T3454. 2015-09-01 14:47:22 -07:00
stores fix(draft): fix popout draft error & add tests 2015-09-06 14:55:06 -07:00
tasks fix(draft-list): draft list removes draft when the message sends 2015-09-08 13:11:34 -07:00
action-bridge-spec.coffee
atom-spec.coffee fix(thread-list): set min-width to threadlist. fixes T3435. 2015-09-04 12:27:05 -07:00
auto-update-manager-spec.coffee
buffered-process-spec.coffee
clipboard-spec.coffee
component-registry-spec.coffee
database-object-registry-spec.coffee
database-view-spec.coffee
dom-utils-spec.coffee
launch-services-spec.coffee
menu-manager-spec.coffee
model-view-selection-spec.coffee
model-view-spec.coffee
module-cache-spec.coffee
nylas-api-spec.coffee test(api): add specs for nylas api 2015-09-02 12:22:20 -07:00
nylas-protocol-handler-spec.coffee
package-manager-spec.coffee
package-spec.coffee
quoted-html-parser-spec.coffee fix(composer): much better specs for composer & quoted text 2015-09-03 19:41:56 -07:00
quoted-plain-text-parser-spec.coffee
style-manager-spec.coffee
styles-element-spec.coffee
test_utils.coffee
theme-manager-spec.coffee
undo-manager-spec.coffee
utils-spec.coffee