mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 22:18:29 +00:00
ui: fix possible suspect for race condition on accept contact (#6121)
This commit is contained in:
+3
-1
@@ -707,7 +707,6 @@ fun acceptContactRequest(
|
||||
withBGApi {
|
||||
inProgress?.value = true
|
||||
val contact = chatModel.controller.apiAcceptContactRequest(rhId, incognito, contactRequestId)
|
||||
inProgress?.value = false
|
||||
if (contact != null && isCurrentUser) {
|
||||
val chat = Chat(remoteHostId = rhId, ChatInfo.Direct(contact), listOf())
|
||||
withContext(Dispatchers.Main) {
|
||||
@@ -716,9 +715,12 @@ fun acceptContactRequest(
|
||||
} else {
|
||||
chatModel.chatsContext.replaceChat(rhId, contactRequestChatId(contactRequestId), chat)
|
||||
}
|
||||
inProgress?.value = false
|
||||
}
|
||||
chatModel.setContactNetworkStatus(contact, NetworkStatus.Connected())
|
||||
close?.invoke(chat)
|
||||
} else {
|
||||
inProgress?.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user