WhisperSystems/TextSecure — pull request #1510 by AsamK (2014-05-18 22:13:44+00:00)
Title: Improve drafts

The first commit is a small fix to delete a draft when the conversation is deleted. Until now the draft wasn't deleted and could reappear in a new thread. The bug can easily be reproduced by creating a new group, creating a draft, delete the thread and create a new group. The new group now contains the draft from the old group.

The second commit adds the possibility to save drafts for recipients you haven't written to before, i.e. no thread exists. This also fixes the behavior described by @landry314 in #103. It is implemented by creating a new thread (if necessary) when a draft is saved. When the draft is deleted and no other messages exist in the thread, the thread is deleted in ThreadDatabase.update().

I also modified ThreadDatabase.update() to show an italic "Draft" in the ConversationList, when a draft exists. This way threads with drafts are shown on the top (sorted by date) and drafts for new recipients don't show the default "(No subject)" text. I'm not sure if I implemented this the correct way. I added a new constant MESSAGE_DRAFT_BIT in MmsSmsColumns.Types to indicate the conversation contains a draft.