fix(@desktop/messages): show reply header if we send image

This commit is contained in:
mprakhov 2023-03-30 00:26:56 +02:00 committed by Mykhailo Prakhov
parent 7fb9b37620
commit f0d57d19cf
7 changed files with 14 additions and 13 deletions

View File

@ -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,

View File

@ -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.} =

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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])

View File

@ -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 {