mozilla-b2g/gaia — pull request #15563 by evhan55 (2014-01-21 15:50:37+00:00)
Title: Bug 952484 - [Messages][Drafts] We should not show the "replace draft" screen if the user has not changed the draft

- `compose.js`
- Every time content (message, subject, attachment) is changed, set draft to edited
- `drafts.js`
- Set draft to not edited when it's first created
- `message_manager.js`
- After a threadless draft is loaded in #new panel, set draft to not edited
- After a threaded draft is loaded in #thread-## panel, set draft to not edited
- `thread_ui.js`
- Do not prompt for replacement if the draft has not been marked as edited
- Tests
- Unit tests
- `compose_test.js`
- Check that draft is marked as edited when content changes
- `drafts_test.js`
- Check that draft is not marked as edited upon creation
- `message_manager.js`
- Check that draft is not marked as edited after thread-less draft loads or after thread-bound draft loads
- `thread_ui_test.js`
- Check that replacement dialog is not called if draft was not edited
- Manual tests
- Thread-bound draft thread
- Load thread, make no changes, press back => no dialog
- Load thread, make subject change, press back => dialog
- Load thread, make attachment change, press back => dialog
- Load thread, make message change, press back => dialog
- Thread-less draft thread
- Load thread, make no changes, press back => no dialog
- Load thread, make subject change, press back => dialog
- Load thread, make attachment change, press back => dialog
- Load thread, make message change, press back => dialog
- Load thread, make recipient change, press back => dialog
- Notes
- Dialog comes back even if the content is 'edited' but not actually changed
- Dialog comes back if **empty** subject is added (this triggers a `Compose.onContentChanged`)
- Since thread-less drafts are orphaned and resaved every time, they will move up in the thread list even if their content didn't change (because they are resaved)