Fix public chat deletion

This commit is contained in:
Niels Andriesse 2020-01-24 09:59:37 +11:00
parent 60da6dc58c
commit 93e1cd7756

View File

@ -202,11 +202,14 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
override fun run() {
AsyncTask.execute {
threadDatabase.deleteConversation(threadID)
val publicChat = DatabaseFactory.getLokiThreadDatabase(activity).getPublicChat(threadID)
if (publicChat != null) {
val apiDatabase = DatabaseFactory.getLokiAPIDatabase(activity)
apiDatabase.removeLastMessageServerID(publicChat.channel, publicChat.server)
apiDatabase.removeLastDeletionServerID(publicChat.channel, publicChat.server)
ApplicationContext.getInstance(activity).lokiPublicChatAPI!!.leave(publicChat.channel, publicChat.server)
}
threadDatabase.deleteConversation(threadID)
MessageNotifier.updateNotification(activity)
}
}