diff --git a/src/app/modules/main/chat_section/chat_content/input_area/controller.nim b/src/app/modules/main/chat_section/chat_content/input_area/controller.nim index e20e79a57b..d1a52a8e39 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/controller.nim @@ -76,8 +76,8 @@ proc getChatId*(self: Controller): string = proc belongsToCommunity*(self: Controller): bool = return self.belongsToCommunity -proc sendImages*(self: Controller, imagePathsAndDataJson: string, msg: string): string = - self.chatService.sendImages(self.chatId, imagePathsAndDataJson, msg) +proc sendImages*(self: Controller, imagePathsAndDataJson: string, msg: string, replyTo: string): string = + self.chatService.sendImages(self.chatId, imagePathsAndDataJson, msg, replyTo) proc sendChatMessage*( self: Controller, diff --git a/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim b/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim index 5664c65b42..b0bd92f1cd 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim @@ -20,7 +20,7 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} = method sendChatMessage*(self: AccessInterface, msg: string, replyTo: string, contentType: int) {.base.} = raise newException(ValueError, "No implementation available") -method sendImages*(self: AccessInterface, imagePathsJson: string, msg: string): string {.base.} = +method sendImages*(self: AccessInterface, imagePathsJson: string, msg: string, replyTo: string): string {.base.} = raise newException(ValueError, "No implementation available") method requestAddressForTransaction*(self: AccessInterface, fromAddress: string, amount: string, tokenAddress: string) {.base.} = diff --git a/src/app/modules/main/chat_section/chat_content/input_area/module.nim b/src/app/modules/main/chat_section/chat_content/input_area/module.nim index ca484ee459..719482f413 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/module.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/module.nim @@ -62,8 +62,8 @@ method getModuleAsVariant*(self: Module): QVariant = method getChatId*(self: Module): string = return self.controller.getChatId() -method sendImages*(self: Module, imagePathsAndDataJson: string, msg: string): string = - self.controller.sendImages(imagePathsAndDataJson, msg) +method sendImages*(self: Module, imagePathsAndDataJson: string, msg: string, replyTo: string): string = + self.controller.sendImages(imagePathsAndDataJson, msg, replyTo) method sendChatMessage*( self: Module, diff --git a/src/app/modules/main/chat_section/chat_content/input_area/view.nim b/src/app/modules/main/chat_section/chat_content/input_area/view.nim index b3a3d3f66f..c2201e5e56 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/view.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/view.nim @@ -38,8 +38,8 @@ QtObject: contentType: int) {.slot.} = self.delegate.sendChatMessage(msg, replyTo, contentType) - proc sendImages*(self: View, imagePathsAndDataJson: string, msg: string): string {.slot.} = - self.delegate.sendImages(imagePathsAndDataJson, msg) + proc sendImages*(self: View, imagePathsAndDataJson: string, msg: string, replyTo: string): string {.slot.} = + self.delegate.sendImages(imagePathsAndDataJson, msg, replyTo) proc acceptAddressRequest*(self: View, messageId: string , address: string) {.slot.} = self.delegate.acceptRequestAddressForTransaction(messageId, address) diff --git a/src/app_service/service/chat/service.nim b/src/app_service/service/chat/service.nim index 0fc2ff4857..b79ed3587e 100644 --- a/src/app_service/service/chat/service.nim +++ b/src/app_service/service/chat/service.nim @@ -353,7 +353,7 @@ QtObject: for chat in chats: if (chat.active): self.events.emit(SIGNAL_CHAT_CREATED, CreatedChatArgs(chat: chat)) - + for msg in messages: for chat in chats: if chat.id == msg.chatId: @@ -448,7 +448,7 @@ QtObject: error "Error deleting channel", chatId, msg = e.msg return - proc sendImages*(self: Service, chatId: string, imagePathsAndDataJson: string, msg: string): string = + proc sendImages*(self: Service, chatId: string, imagePathsAndDataJson: string, msg: string, replyTo: string): string = result = "" try: var images = Json.decode(imagePathsAndDataJson, seq[string]) @@ -484,7 +484,7 @@ QtObject: imagePaths.add(imagePath) - let response = status_chat.sendImages(chatId, imagePaths, msg) + let response = status_chat.sendImages(chatId, imagePaths, msg, replyTo) for imagePath in imagePaths: removeFile(imagePath) diff --git a/src/backend/chat.nim b/src/backend/chat.nim index fad731def6..e2309f452a 100644 --- a/src/backend/chat.nim +++ b/src/backend/chat.nim @@ -79,7 +79,7 @@ proc sendChatMessage*( } ]) -proc sendImages*(chatId: string, images: var seq[string], msg: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendImages*(chatId: string, images: var seq[string], msg: string, replyTo: string): RpcResponse[JsonNode] {.raises: [Exception].} = let imagesJson = %* images.map(image => %* { "chatId": chatId, @@ -87,7 +87,8 @@ proc sendImages*(chatId: string, images: var seq[string], msg: string): RpcRespo "imagePath": image, # TODO is this still needed # "ensName": preferredUsername, - "text": msg + "text": msg, + "responseTo": replyTo, } ) callPrivateRPC("sendChatMessages".prefix, %* [imagesJson]) diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 44a7221d53..96c8291a96 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -177,7 +177,7 @@ QtObject { } if (fileUrlsAndSources.length > 0) { - chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources), textMsg.trim()) + chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources), textMsg.trim(), replyMessageId) result = true } else {