fix(@desktop/messages): show reply header if we send image
This commit is contained in:
parent
7fb9b37620
commit
f0d57d19cf
|
@ -76,8 +76,8 @@ proc getChatId*(self: Controller): string =
|
||||||
proc belongsToCommunity*(self: Controller): bool =
|
proc belongsToCommunity*(self: Controller): bool =
|
||||||
return self.belongsToCommunity
|
return self.belongsToCommunity
|
||||||
|
|
||||||
proc sendImages*(self: Controller, imagePathsAndDataJson: string, msg: string): string =
|
proc sendImages*(self: Controller, imagePathsAndDataJson: string, msg: string, replyTo: string): string =
|
||||||
self.chatService.sendImages(self.chatId, imagePathsAndDataJson, msg)
|
self.chatService.sendImages(self.chatId, imagePathsAndDataJson, msg, replyTo)
|
||||||
|
|
||||||
proc sendChatMessage*(
|
proc sendChatMessage*(
|
||||||
self: Controller,
|
self: Controller,
|
||||||
|
|
|
@ -20,7 +20,7 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
|
||||||
method sendChatMessage*(self: AccessInterface, msg: string, replyTo: string, contentType: int) {.base.} =
|
method sendChatMessage*(self: AccessInterface, msg: string, replyTo: string, contentType: int) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
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")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method requestAddressForTransaction*(self: AccessInterface, fromAddress: string, amount: string, tokenAddress: string) {.base.} =
|
method requestAddressForTransaction*(self: AccessInterface, fromAddress: string, amount: string, tokenAddress: string) {.base.} =
|
||||||
|
|
|
@ -62,8 +62,8 @@ method getModuleAsVariant*(self: Module): QVariant =
|
||||||
method getChatId*(self: Module): string =
|
method getChatId*(self: Module): string =
|
||||||
return self.controller.getChatId()
|
return self.controller.getChatId()
|
||||||
|
|
||||||
method sendImages*(self: Module, imagePathsAndDataJson: string, msg: string): string =
|
method sendImages*(self: Module, imagePathsAndDataJson: string, msg: string, replyTo: string): string =
|
||||||
self.controller.sendImages(imagePathsAndDataJson, msg)
|
self.controller.sendImages(imagePathsAndDataJson, msg, replyTo)
|
||||||
|
|
||||||
method sendChatMessage*(
|
method sendChatMessage*(
|
||||||
self: Module,
|
self: Module,
|
||||||
|
|
|
@ -38,8 +38,8 @@ QtObject:
|
||||||
contentType: int) {.slot.} =
|
contentType: int) {.slot.} =
|
||||||
self.delegate.sendChatMessage(msg, replyTo, contentType)
|
self.delegate.sendChatMessage(msg, replyTo, contentType)
|
||||||
|
|
||||||
proc sendImages*(self: View, imagePathsAndDataJson: string, msg: string): string {.slot.} =
|
proc sendImages*(self: View, imagePathsAndDataJson: string, msg: string, replyTo: string): string {.slot.} =
|
||||||
self.delegate.sendImages(imagePathsAndDataJson, msg)
|
self.delegate.sendImages(imagePathsAndDataJson, msg, replyTo)
|
||||||
|
|
||||||
proc acceptAddressRequest*(self: View, messageId: string , address: string) {.slot.} =
|
proc acceptAddressRequest*(self: View, messageId: string , address: string) {.slot.} =
|
||||||
self.delegate.acceptRequestAddressForTransaction(messageId, address)
|
self.delegate.acceptRequestAddressForTransaction(messageId, address)
|
||||||
|
|
|
@ -353,7 +353,7 @@ QtObject:
|
||||||
for chat in chats:
|
for chat in chats:
|
||||||
if (chat.active):
|
if (chat.active):
|
||||||
self.events.emit(SIGNAL_CHAT_CREATED, CreatedChatArgs(chat: chat))
|
self.events.emit(SIGNAL_CHAT_CREATED, CreatedChatArgs(chat: chat))
|
||||||
|
|
||||||
for msg in messages:
|
for msg in messages:
|
||||||
for chat in chats:
|
for chat in chats:
|
||||||
if chat.id == msg.chatId:
|
if chat.id == msg.chatId:
|
||||||
|
@ -448,7 +448,7 @@ QtObject:
|
||||||
error "Error deleting channel", chatId, msg = e.msg
|
error "Error deleting channel", chatId, msg = e.msg
|
||||||
return
|
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 = ""
|
result = ""
|
||||||
try:
|
try:
|
||||||
var images = Json.decode(imagePathsAndDataJson, seq[string])
|
var images = Json.decode(imagePathsAndDataJson, seq[string])
|
||||||
|
@ -484,7 +484,7 @@ QtObject:
|
||||||
|
|
||||||
imagePaths.add(imagePath)
|
imagePaths.add(imagePath)
|
||||||
|
|
||||||
let response = status_chat.sendImages(chatId, imagePaths, msg)
|
let response = status_chat.sendImages(chatId, imagePaths, msg, replyTo)
|
||||||
|
|
||||||
for imagePath in imagePaths:
|
for imagePath in imagePaths:
|
||||||
removeFile(imagePath)
|
removeFile(imagePath)
|
||||||
|
|
|
@ -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 => %*
|
let imagesJson = %* images.map(image => %*
|
||||||
{
|
{
|
||||||
"chatId": chatId,
|
"chatId": chatId,
|
||||||
|
@ -87,7 +87,8 @@ proc sendImages*(chatId: string, images: var seq[string], msg: string): RpcRespo
|
||||||
"imagePath": image,
|
"imagePath": image,
|
||||||
# TODO is this still needed
|
# TODO is this still needed
|
||||||
# "ensName": preferredUsername,
|
# "ensName": preferredUsername,
|
||||||
"text": msg
|
"text": msg,
|
||||||
|
"responseTo": replyTo,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
callPrivateRPC("sendChatMessages".prefix, %* [imagesJson])
|
callPrivateRPC("sendChatMessages".prefix, %* [imagesJson])
|
||||||
|
|
|
@ -177,7 +177,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileUrlsAndSources.length > 0) {
|
if (fileUrlsAndSources.length > 0) {
|
||||||
chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources), textMsg.trim())
|
chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources), textMsg.trim(), replyMessageId)
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue