fix(@desktop/chat): allow to send attached image without text input

This commit is contained in:
mprakhov 2023-01-10 16:50:47 +02:00 committed by Mykhailo Prakhov
parent 055fec9109
commit 52d336b5a6
3 changed files with 9 additions and 11 deletions

View File

@ -88,7 +88,7 @@ proc sendImages*(chatId: string, images: var seq[string]): RpcResponse[JsonNode]
"imagePath": image,
# TODO is this still needed
# "ensName": preferredUsername,
"text": "Please upgrade your status version to view images"
"text": "🖼️"
}
)
callPrivateRPC("sendChatMessages".prefix, %* [imagesJson])

View File

@ -103,12 +103,15 @@ QtObject {
function sendMessage(chatId, event, text, replyMessageId, fileUrlsAndSources) {
chatCommunitySectionModule.prepareChatContentModuleForChatId(chatId)
const chatContentModule = chatCommunitySectionModule.getChatContentModule()
var result = false
if (fileUrlsAndSources.length > 0){
chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources));
chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources))
result = true
}
let msg = globalUtilsInst.plainText(StatusQUtils.Emoji.deparse(text))
if (msg.length > 0) {
let msg = globalUtils.plainText(StatusQUtils.Emoji.deparse(text))
if (msg.trim() !== "") {
msg = interpretMessage(msg)
chatContentModule.inputAreaModule.sendMessage(
@ -120,9 +123,9 @@ QtObject {
if (event)
event.accepted = true
return true
result = true
}
return false
return result
}

View File

@ -342,11 +342,6 @@ Rectangle {
function onKeyPress(event) {
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
if (getPlainText().trim() === "") {
event.accepted = true;
return
}
if (checkTextInsert()) {
event.accepted = true;
return