Oh boy, I just realized I don't know the difference between draft.id and
draft.threadId. Ok.


On Thu, Dec 5, 2013 at 12:54 PM, Adam Hyland <notifications@github.com>wrote:

> In apps/sms/js/thread_ui.js:
>
> > @@ -1918,6 +1933,15 @@ var ThreadUI = global.ThreadUI = {
> >      messageDOM.classList.remove('sending');
> >      messageDOM.classList.add('sent');
> >
> > +    // If the message we sent is associated with a threadId
> > +    // which has a draft, delete it
> > +    // Use Drafts.byThreadId as it is mocked during testing
> > +    if (Drafts.byThreadId(threadId).length) {
> > +      Drafts.delete({
> > +        threadId: threadId
>
> If it's {id: threadId} the condition here<https://github.com/rwaldron/gaia/blob/v1.3-drafts/apps/sms/js/drafts.js#L125>will be falsey because the id is defined. Then it will try to search
> through the array, update the index, then remove only the draft (on L136).
>
> If the draft id is not defined, it will zero out the entire array, which
> is what we want because we don't know the id of a draft on another thread
> (or if we do I don't know how to get it easily).
>
> The above is my understanding of Drafts.delete(), not gospel. So I may be
> wrong. :)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/rwaldron/gaia/pull/2/files#r8137679>
> .
>



-- 
Evelyn Eastmond
evhan55@alum.mit.edu