fix(Chat): Messages with GIF not display the url

Closes: #6005
This commit is contained in:
Boris Melnik 2022-06-07 17:47:45 +03:00 committed by Iuri Matias
parent 260f10a83e
commit d8b00bef02
5 changed files with 10 additions and 0 deletions

View File

@ -318,6 +318,7 @@ Item {
ChatTextView {
id: chatText
message: root.message
anchors.top: parent.top
anchors.topMargin: chatBox.chatVerticalPadding
anchors.left: parent.left

View File

@ -11,6 +11,7 @@ import StatusQ.Core.Utils 0.1 as StatusQUtils
Item {
id: root
property string message: ""
property var store
property bool longChatText: true
property bool veryLongChatText: globalUtils.plainText(message).length > Constants.limitLongChatTextCompactMode

View File

@ -64,6 +64,8 @@ Item {
property bool editModeOn: false
property string linkUrls: ""
property string message: ""
property var transactionParams
signal openStickerPackPopup(string stickerPackId)
@ -513,6 +515,7 @@ Item {
readonly property int leftPadding: chatImage.anchors.leftMargin + chatImage.width + chatHorizontalPadding
visible: isText || isEmoji || isImage
message: Utils.removeGifUrls(root.message)
anchors.top: parent.top
anchors.topMargin: isEmoji ? 2 : 0
anchors.left: parent.left

View File

@ -334,6 +334,7 @@ Column {
CompactMessageView {
container: root
store: root.store
message: root.message
messageStore: root.messageStore
usersStore: root.usersStore
contactsStore: root.contactsStore

View File

@ -542,6 +542,10 @@ QtObject {
return Constants.acceptedImageExtensions.some(ext => url.toLowerCase().includes(ext))
}
function removeGifUrls(message) {
return message.replace(/(?:https?|ftp):\/\/[\n\S]*(\.gif)+/gm, '');
}
function hasDragNDropImageExtension(url) {
return Constants.acceptedDragNDropImageExtensions.some(ext => url.toLowerCase().includes(ext))
}