feat(@desktop/chat): Hide chat text when the link is only an image

fixes #3366
This commit is contained in:
Anthony Laibe 2021-09-06 14:19:57 +02:00 committed by Iuri Matias
parent 95a3b63adb
commit 6f2dab2e29
2 changed files with 10 additions and 2 deletions

View File

@ -11,7 +11,6 @@ Item {
property alias textField: chatText property alias textField: chatText
id: root id: root
visible: isText || isEmoji
z: 51 z: 51
implicitHeight: visible ? (showMoreLoader.active ? childrenRect.height - 10 : chatText.height) : 0 implicitHeight: visible ? (showMoreLoader.active ? childrenRect.height - 10 : chatText.height) : 0

View File

@ -286,8 +286,17 @@ Item {
visible: !isEdit visible: !isEdit
ChatText { ChatText {
readonly property int leftPadding: chatImage.anchors.leftMargin + chatImage.width + root.chatHorizontalPadding
id: chatText id: chatText
readonly property int leftPadding: chatImage.anchors.leftMargin + chatImage.width + root.chatHorizontalPadding
visible: {
const urls = root.linkUrls.split(" ")
if (urls.length === 1 && Utils.hasImageExtension(urls[0]) && appSettings.displayChatImages) {
return false
}
return isText || isEmoji
}
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: isEmoji ? 2 : 0 anchors.topMargin: isEmoji ? 2 : 0
anchors.left: parent.left anchors.left: parent.left