Closed Bug 1080504 Opened 7 years ago Closed 5 years ago

[Messages][Drafts] Draft is neither removed nor updated if it was discarded or modified from another app instance (in Inbox only, until next restart)


(Firefox OS Graveyard :: Gaia::SMS, defect)

Gonk (Firefox OS)
Not set


(Not tracked)



(Reporter: azasypkin, Unassigned, Mentored)



(Whiteboard: [sms-papercuts][sms-most-wanted][lang=js])

*** Follow-up from bug 1058459 ***

In patch for bug 1058459 we don't cover the following case:

1. Open Messages app (Instance #1) from HomeScreen;
2. Open Contacts app from HomeScreen;
3. In Contacts go to contact details of any contact (with number) and choose "Send message" option;
4. Once Messages app appeared (Instance #2), press Home button (draft should be automatically saved);
5. Activate Instance #1 from HomeScreen->Messages or Task Manager->Messages and observe that newly created draft is in the list;
6. Go back to Instance #2 via HomeScreen->Contacts or Task Manager->Contacts and tap on "X" to close activity and select "Discard draft" option;
7. Activate Instance #1 once again and observe thread list.

Expected result: discarded draft should be removed;

Actual result: draft is still in the thread list.

Though it's unclear what to do in case user opens that draft in the Instance #1, so that the same draft is opened by two Messages app instances at the same time.
Whiteboard: [sms-papercuts]
Duplicate of this bug: 1152715
Blocks: 1176976
No longer blocks: 1176976
Updating title to stress that we want to fix both discard and modification cases. Modification case will become more visible after patch for bug 1176976 since now we always create a draft to support activity instance and don't remove draft in ConversationView.handleDraft.
Summary: [Messages][Drafts] Draft isn't removed (from UI only) if it was discarded from activity → [Messages][Drafts] Draft is neither removed nor updated if it was discarded or modified from another app instance (in Inbox only, until next restart)
Depends on: 1176976
This issue became more apparent after bug 1144132, so now in the main app instance we'll always see draft that's saved when user adds attachment in activity instance even after message is sent (that automatically discards draft for just sent message).

Likely can be fixed by making Drafts smarter in analyzing "drafts-changed" event from InterInstanceEventDispatcher [1], so that Drafts can emit "saved"/"deleted" event for every change it finds while comparing old and new drafts stores instead of running "renderDrafts" all the time [2].

It can be a mentored bug, though it's _not_ a good first one and requires prior experience in Firefox OS. This bug also has a good follow-up bug 1140339 (once bug 1140344 is finally resolved).


Mentor: azasypkin
See Also: → 1213199, 1144132, 1140339
Whiteboard: [sms-papercuts] → [sms-papercuts][sms-most-wanted][lang=js]
Please note that after Bug 1217075 landed, the drafts-change event dispatch from another instance will become draft-saved/draft-deleted with target draft. Now we can update the draft directly once we get draft save/deleted event. A small reminder that we will need to add Drafts.init in conversation startup for interInstance event handling in split view mode.
Mass closing of Gaia::SMS bugs. End of an era :(
Closed: 5 years ago
Resolution: --- → WONTFIX
Mass closing of Gaia::SMS bugs. End of an era :(
You need to log in before you can comment on or make changes to this bug.