fix(@desktop/chat): replies are not working in communities (#34)

This check is here, because of issue#3490, that was happening due to different
messages' order (received from status go). We were emitting always a message on
index 0, what in some cases was not the reply message (doesn't contain "responseTo"
value). This should be handled in status-go but since that part is used by mobile
also and it is working for them, change is applied here.

Fixes: #3490
This commit is contained in:
saledjenic 2021-09-17 16:36:02 +02:00 committed by GitHub
parent 87dd134eac
commit 58f10babba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -336,7 +336,14 @@ proc processMessageUpdateAfterSend(self: ChatModel, response: string): (seq[Chat
self.events.emit("messageSendingFailed", Args()) self.events.emit("messageSendingFailed", Args())
return return
self.events.emit("messageSendingSuccess", MessageSendingSuccess(message: messages[0], chat: chats[0])) # This fixes issue#3490
var msg = messages[0]
for m in messages:
if(m.responseTo.len > 0):
msg = m
break
self.events.emit("messageSendingSuccess", MessageSendingSuccess(message: msg, chat: chats[0]))
proc sendMessage*(self: ChatModel, chatId: string, msg: string, replyTo: string = "", contentType: int = ContentType.Message.int, communityId: string = "") = proc sendMessage*(self: ChatModel, chatId: string, msg: string, replyTo: string = "", contentType: int = ContentType.Message.int, communityId: string = "") =
var response = status_chat.sendChatMessage(chatId, msg, replyTo, contentType, communityId) var response = status_chat.sendChatMessage(chatId, msg, replyTo, contentType, communityId)