Closed
Bug 959196
Opened 11 years ago
Closed 11 years ago
[Messages][Drafts] Don't auto-save new draft when hiding app and then draft is discarded
Categories
(Firefox OS Graveyard :: Gaia::SMS, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: evhan55, Assigned: evhan55)
References
Details
Attachments
(1 file)
The spec originally asked for this behavior, but the behavior is being altered.
This bug was originally reported in bugs 952514 and 958103:
https://bugzilla.mozilla.org/show_bug.cgi?id=958103#c10
STR:
* open "new message" view
* add some text in the composer
* press home
* press the "messages" icon
* press back
* press "discard draft"
Expected:
* no new draft
Actual:
* a new draft was created
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → evelyn
Comment 1•11 years ago
|
||
I think the draft that was created should just be discarded when we get a visibilitychange event with document.hidden=false. Don't know how easy it is though ;)
Assignee | ||
Comment 2•11 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #1)
> I think the draft that was created should just be discarded when we get a
> visibilitychange event with document.hidden=false. Don't know how easy it is
> though ;)
The problem was happening because MessageManager.draft was not properly set if this brand new draft was auto-saved. Fixing that issue fixes this bug, so I think that may be a better fix in my opinion. I will feedback? you in any case. Thank you!
Assignee | ||
Comment 3•11 years ago
|
||
- `thread_ui.js`
- If `MessageManager` is not already holding onto a draft when a brand new is auto-saved, then set it. this way preservation/discarding works as expected
- Tests
- `thread_ui_test.js`
- Test that `MessageManager.draft` is properly set if it didn't exist before saving a draft
Attachment #8359428 -
Flags: review?(waldron.rick)
Attachment #8359428 -
Flags: feedback?(felash)
Comment 4•11 years ago
|
||
Comment on attachment 8359428 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/15273
Nice r=me
Attachment #8359428 -
Flags: review?(waldron.rick) → review+
Comment 6•11 years ago
|
||
Comment on attachment 8359428 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/15273
good for me too.
2 questions/comments for you (and for me ;) ) though
* Can you please clarify what "preserve" means exactly ?
* I would have added a "visibilitychange" handler in ThreadUI instead of using the one in MessageManager. Also, why calling Drafts.store() at the end even when we don't save drafts?
Attachment #8359428 -
Flags: feedback?(felash) → feedback+
Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #6)
> Comment on attachment 8359428 [details] [review]
> https://github.com/mozilla-b2g/gaia/pull/15273
>
> good for me too.
>
> 2 questions/comments for you (and for me ;) ) though
> * Can you please clarify what "preserve" means exactly ?
Addressed in patch with a clearer comment.
> * I would have added a "visibilitychange" handler in ThreadUI instead of
> using the one in MessageManager. Also, why calling Drafts.store() at the end
> even when we don't save drafts?
Reported as a new bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=959696
Assignee | ||
Comment 8•11 years ago
|
||
Closed and landed: https://github.com/mozilla-b2g/gaia/commit/08e03dc347187d69e1ca7223e1eb1c368844e6cb
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•