fix(@desktop/chat): allow to send attached image without text input
This commit is contained in:
parent
055fec9109
commit
52d336b5a6
|
@ -88,7 +88,7 @@ proc sendImages*(chatId: string, images: var seq[string]): RpcResponse[JsonNode]
|
||||||
"imagePath": image,
|
"imagePath": image,
|
||||||
# TODO is this still needed
|
# TODO is this still needed
|
||||||
# "ensName": preferredUsername,
|
# "ensName": preferredUsername,
|
||||||
"text": "Please upgrade your status version to view images"
|
"text": "🖼️"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
callPrivateRPC("sendChatMessages".prefix, %* [imagesJson])
|
callPrivateRPC("sendChatMessages".prefix, %* [imagesJson])
|
||||||
|
|
|
@ -103,12 +103,15 @@ QtObject {
|
||||||
function sendMessage(chatId, event, text, replyMessageId, fileUrlsAndSources) {
|
function sendMessage(chatId, event, text, replyMessageId, fileUrlsAndSources) {
|
||||||
chatCommunitySectionModule.prepareChatContentModuleForChatId(chatId)
|
chatCommunitySectionModule.prepareChatContentModuleForChatId(chatId)
|
||||||
const chatContentModule = chatCommunitySectionModule.getChatContentModule()
|
const chatContentModule = chatCommunitySectionModule.getChatContentModule()
|
||||||
|
var result = false
|
||||||
|
|
||||||
if (fileUrlsAndSources.length > 0){
|
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))
|
let msg = globalUtils.plainText(StatusQUtils.Emoji.deparse(text))
|
||||||
if (msg.length > 0) {
|
if (msg.trim() !== "") {
|
||||||
msg = interpretMessage(msg)
|
msg = interpretMessage(msg)
|
||||||
|
|
||||||
chatContentModule.inputAreaModule.sendMessage(
|
chatContentModule.inputAreaModule.sendMessage(
|
||||||
|
@ -120,9 +123,9 @@ QtObject {
|
||||||
if (event)
|
if (event)
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
|
|
||||||
return true
|
result = true
|
||||||
}
|
}
|
||||||
return false
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -342,11 +342,6 @@ Rectangle {
|
||||||
|
|
||||||
function onKeyPress(event) {
|
function onKeyPress(event) {
|
||||||
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
|
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
|
||||||
if (getPlainText().trim() === "") {
|
|
||||||
event.accepted = true;
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkTextInsert()) {
|
if (checkTextInsert()) {
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue