Closed Bug 950914 Opened 11 years ago Closed 11 years ago

[Messages][Drafts] Replace existing draft when hiding app while showing unsent, existing draft content

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: evhan55, Assigned: evhan55)

References

Details

Attachments

(1 file)

STR:

1) Create a draft to recipient '333' and save
2) Click back to go to thread list
3) Click back into the same thread
4) Hide the app with home button press
5) Launch messages app
6) Hide the app with home button press
7) Launch messages app
8) Click back to go to thread list, choose 'Save as Draft'

Expected:
- There is only one draft entry to recipient '333'
- The draft was simply replaced

Actual:
- There are multiple draft entries to recipient '333'
- New drafts were made every time the app was hidden
Assignee: nobody → evelyn
This may not be trivial to solve given the current spec and the current code.
I'd like to run something by you Rick:

*Brand New Draft*
When you hide and recall the app, new drafts get saved every time, because it's an implicit save without a dialog.  We discussed this is to spec, and we implemented it that way against our recommendations.

*Existing Draft*
When you hide and recall the app *the first time*, it does correctly replace, actually.  But then, MessageManager.draft is set to null, correctly, since the draft is considered saved and done with.  Now, when you hide and recall the app *the following times*, it now considers the stuff in the composer to all be a fresh new draft, and it starts saving new drafts, just like in the case above.

So, this bug (950914) is actually not a bug, the replacement does indeed happen the first time the app is hidden/recalled*.  But, hiding and recalling more times creates new drafts, which is to spec.

Do you think this is worth solving or should we leave it as another quirk of the current spec?

* This was tested on rwaldron/v1.3-drafts with rwaldron/947211 applied on top
Flags: needinfo?(waldron.rick)
From IRC

<rwaldron> you could just make saveMessageDraft have two paths
<rwaldron> onVisibilityChange => don't clear MessageManager.draft
<rwaldron> Everythings else => clear it
<evhan55> okay! that would be easy
<rwaldron> ThreadUI.saveMessageDraft({ preserve: true });
<rwaldron> or something
<rwaldron> then at the end of ThreadUI.saveMessageDraft... if !opts.preserve...
<rwaldron> seems ok
- `message_manager.js`
    - specify that the draft should be preserved when app hides
- `thread_ui.js`
    - if draft is specified to be preserved in `saveDraft`, preserve it

Tests
- `message_manager_test.js`
    - make sure preserve flag is passed when app hides
- `thread_ui_test.js`
    - make sure draft is preserved (or not) depending on what is specified in `saveDraft`
Attachment #8350177 - Flags: review?(waldron.rick)
Attachment #8350177 - Flags: review?(waldron.rick) → review+
Flags: needinfo?(waldron.rick)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: