From 1cca25e08d0f99fb28ac91b21e29a5b982a43ef4 Mon Sep 17 00:00:00 2001 From: MishkaRogachev Date: Mon, 4 Jul 2022 17:39:56 +0300 Subject: [PATCH] feat(chat): Message display several images Close #4905 --- src/app_service/service/chat/service.nim | 17 +++-------------- .../shared/views/chat/CompactMessageView.qml | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/app_service/service/chat/service.nim b/src/app_service/service/chat/service.nim index ad85b42c6e..b41381634a 100644 --- a/src/app_service/service/chat/service.nim +++ b/src/app_service/service/chat/service.nim @@ -188,7 +188,6 @@ QtObject: self.channelGroups[channelGroupId].chats.add(chat) else: self.channelGroups[channelGroupId].chats[index] = chat - proc parseChatResponse*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) = var chats: seq[ChatDto] = @[] @@ -204,24 +203,14 @@ QtObject: chats.add(chat) result = (chats, messages) - proc processMessageUpdateAfterSend*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) = + proc processMessageUpdateAfterSend*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) = result = self.parseChatResponse(response) var (chats, messages) = result if chats.len == 0 or messages.len == 0: error "no chats or messages in the parsed response" return - # The reason why we are sending all the messages with responseTo filled in is because - # the reposnse from status_go doesnt necessarily contain the last reply on the 0th position. - var isaReply = false - var msg = messages[0] - for m in messages: - if(m.responseTo.len > 0): - isaReply = true - msg = m - self.events.emit(SIGNAL_SENDING_SUCCESS, MessageSendingSuccess(message: msg, chat: chats[0])) - - if not isaReply: + for msg in messages: self.events.emit(SIGNAL_SENDING_SUCCESS, MessageSendingSuccess(message: msg, chat: chats[0])) proc processUpdateForTransaction*(self: Service, messageId: string, response: RpcResponse[JsonNode]) = @@ -243,7 +232,7 @@ QtObject: if (showWarning): warn "trying to get chat data for an unexisting chat id", chatId return - + return self.chats[chatId] proc getOneToOneChatNameAndImage*(self: Service, chatId: string): diff --git a/ui/imports/shared/views/chat/CompactMessageView.qml b/ui/imports/shared/views/chat/CompactMessageView.qml index ee82fa0280..a3455ed425 100644 --- a/ui/imports/shared/views/chat/CompactMessageView.qml +++ b/ui/imports/shared/views/chat/CompactMessageView.qml @@ -464,7 +464,7 @@ Item { index += 8 // "