fix(edit-message): Add content-type to edit message request

Closes: #7879
This commit is contained in:
Boris Melnik 2022-11-08 18:44:05 +03:00
parent 88670ec5d0
commit b10b6617cf
8 changed files with 14 additions and 14 deletions

View File

@ -247,8 +247,8 @@ proc getMessageDetails*(self: Controller, messageId: string):
proc deleteMessage*(self: Controller, messageId: string) =
self.messageService.deleteMessage(messageId)
proc editMessage*(self: Controller, messageId: string, updatedMsg: string) =
self.messageService.editMessage(messageId, updatedMsg)
proc editMessage*(self: Controller, messageId: string, contentType: int, updatedMsg: string) =
self.messageService.editMessage(messageId, contentType, updatedMsg)
proc getLinkPreviewData*(self: Controller, link: string, uuid: string): string =
self.messageService.asyncGetLinkPreviewData(link, uuid)

View File

@ -116,7 +116,7 @@ method deleteMessage*(self: AccessInterface, messageId: string) {.base.} =
method onMessageDeleted*(self: AccessInterface, messageId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method editMessage*(self: AccessInterface, messageId: string, updatedMsg: string) {.base.} =
method editMessage*(self: AccessInterface, messageId: string, contentType: int, updatedMsg: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onHistoryCleared*(self: AccessInterface) {.base.} =

View File

@ -450,8 +450,8 @@ method deleteMessage*(self: Module, messageId: string) =
method onMessageDeleted*(self: Module, messageId: string) =
self.view.model().removeItem(messageId)
method editMessage*(self: Module, messageId: string, updatedMsg: string) =
self.controller.editMessage(messageId, updatedMsg)
method editMessage*(self: Module, messageId: string, contentType: int, updatedMsg: string) =
self.controller.editMessage(messageId, contentType, updatedMsg)
method onMessageEdited*(self: Module, message: MessageDto) =
let itemBeforeChange = self.view.model().getItemWithMessageId(message.id)

View File

@ -131,8 +131,8 @@ QtObject:
proc setEditModeOff*(self: View, messageId: string) {.slot.} =
self.model.setEditModeOff(messageId)
proc editMessage*(self: View, messageId: string, updatedMsg: string) {.slot.} =
self.delegate.editMessage(messageId, updatedMsg)
proc editMessage*(self: View, messageId: string, contentType: int, updatedMsg: string) {.slot.} =
self.delegate.editMessage(messageId, contentType, updatedMsg)
proc getLinkPreviewData*(self: View, link: string, uuid: string): string {.slot.} =
return self.delegate.getLinkPreviewData(link, uuid)

View File

@ -784,12 +784,12 @@ proc deleteMessage*(self: Service, messageId: string) =
except Exception as e:
error "error: ", procName="deleteMessage", errName = e.name, errDesription = e.msg
proc editMessage*(self: Service, messageId: string, msg: string) =
proc editMessage*(self: Service, messageId: string, contentType: int, msg: string) =
try:
let allKnownContacts = self.contactService.getContactsByGroup(ContactsGroup.AllKnownContacts)
let processedMsg = message_common.replaceMentionsWithPubKeys(allKnownContacts, msg)
let response = status_go.editMessage(messageId, processedMsg)
let response = status_go.editMessage(messageId, contentType, processedMsg)
var messagesArr: JsonNode
var messages: seq[MessageDto]

View File

@ -62,5 +62,5 @@ proc markCertainMessagesFromChatWithIdAsRead*(chatId: string, messageIds: seq[st
proc deleteMessageAndSend*(messageID: string): RpcResponse[JsonNode] {.raises: [Exception].} =
result = callPrivateRPC("deleteMessageAndSend".prefix, %* [messageID])
proc editMessage*(messageId: string, msg: string): RpcResponse[JsonNode] {.raises: [Exception].} =
result = callPrivateRPC("editMessage".prefix, %* [{"id": messageId, "text": msg}])
proc editMessage*(messageId: string, contentType: int, msg: string): RpcResponse[JsonNode] {.raises: [Exception].} =
result = callPrivateRPC("editMessage".prefix, %* [{"id": messageId, "text": msg, "content-type": contentType}])

View File

@ -162,10 +162,10 @@ QtObject {
messageModule.setEditModeOff(messageId)
}
function editMessage(messageId, updatedMsg) {
function editMessage(messageId, contentType, updatedMsg) {
if(!messageModule)
return
messageModule.editMessage(messageId, updatedMsg)
messageModule.editMessage(messageId, contentType, updatedMsg)
}
function interpretMessage(msg) {

View File

@ -432,7 +432,7 @@ Loader {
const interpretedMessage = root.messageStore.interpretMessage(message)
root.messageStore.setEditModeOff(root.messageId)
root.messageStore.editMessage(root.messageId, interpretedMessage)
root.messageStore.editMessage(root.messageId, root.messageContentType, interpretedMessage)
}
audioMessageInfoText: qsTr("Audio Message")