fix(@desktop/chat): Accept profile deep link in "Send Contact Request to chat key"

Fix #8070
This commit is contained in:
Michal Iskierko 2022-10-28 10:48:59 +02:00 committed by Michał Iskierko
parent 6a72773ab6
commit 234a164597
3 changed files with 16 additions and 5 deletions

View File

@ -414,12 +414,8 @@ QtObject {
return result
}
function isStatusDeepLink(link) {
return link.includes(Constants.deepLinkPrefix) || link.includes(Constants.joinStatusLink)
}
function getLinkDataForStatusLinks(link) {
if (!isStatusDeepLink(link)) {
if (!Utils.isStatusDeepLink(link)) {
return
}

View File

@ -56,6 +56,9 @@ StatusModal {
return
}
if (Utils.isStatusDeepLink(text)) {
text = Utils.getChatKeyFromShareLink(text)
}
Qt.callLater(d.lookupContact, text);
}
}

View File

@ -451,6 +451,10 @@ QtObject {
return matches[0].substring(3)
}
function isStatusDeepLink(link) {
return link.includes(Constants.deepLinkPrefix) || link.includes(Constants.joinStatusLink)
}
function hasImageExtension(url) {
return Constants.acceptedImageExtensions.some(ext => url.toLowerCase().includes(ext))
}
@ -604,6 +608,14 @@ QtObject {
return colorForColorId(pubKeyColorId)
}
function getChatKeyFromShareLink(link) {
let index = link.lastIndexOf("/u/")
if (index === -1) {
return link
}
return link.substring(index + 3)
}
function getCompressedPk(publicKey) {
if (publicKey === "") {
return ""