Rewrite `MessagingController.deleteDraft()` to not use `LocalStore`
@@ -1914,26 +1914,19 @@ public class MessagingController {
});
}
- public void deleteDraft(final Account account, long id) {
- try {
+ public void deleteDraft(Account account, long messageId) {
Long folderId = account.getDraftsFolderId();
if (folderId == null) {
Timber.w("No Drafts folder configured. Can't delete draft.");
return;
}
- LocalStore localStore = localStoreProvider.getInstance(account);
- LocalFolder localFolder = localStore.getFolder(folderId);
- localFolder.open();
- String uid = localFolder.getMessageUidById(id);
- if (uid != null) {
- MessageReference messageReference = new MessageReference(account.getUuid(), folderId, uid);
+ MessageStore messageStore = messageStoreManager.getMessageStore(account);
+ String messageServerId = messageStore.getMessageServerId(messageId);
+ MessageReference messageReference = new MessageReference(account.getUuid(), folderId, messageServerId);
+
deleteMessage(messageReference);
}
- } catch (MessagingException me) {
- Timber.e(me, "Error deleting draft");
- }
- }
public void deleteThreads(final List<MessageReference> messages) {
actOnMessagesGroupedByAccountAndFolder(messages, (account, messageFolder, accountMessages) -> {
