fix(LinkMessages): fix various problems with link messages not showing
Fixes #4131
This commit is contained in:
parent
bc7823fa0d
commit
66840da455
|
@ -501,71 +501,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: profileModel
|
|
||||||
|
|
||||||
onSettingsFileChanged: {
|
|
||||||
// Since https://github.com/status-im/status-desktop/commit/93668ff75
|
|
||||||
// we're hiding the setting to change appearance for compact normal mode
|
|
||||||
// of the UI. For now, compact mode is the new default.
|
|
||||||
//
|
|
||||||
// Prior to this change, most likely many users are still using the
|
|
||||||
// normal mode configuration, so we have to enforce compact mode for
|
|
||||||
// those.
|
|
||||||
if (!localAccountSensitiveSettings.useCompactMode) {
|
|
||||||
localAccountSensitiveSettings.useCompactMode = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const whitelist = profileModel.getLinkPreviewWhitelist()
|
|
||||||
try {
|
|
||||||
const whiteListedSites = JSON.parse(whitelist)
|
|
||||||
let settingsUpdated = false
|
|
||||||
|
|
||||||
// Add Status links to whitelist
|
|
||||||
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
|
||||||
whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false})
|
|
||||||
let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
|
||||||
|
|
||||||
if (!settings) {
|
|
||||||
settings = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Status links as true. We intercept thoseURLs so it is privacy-safe
|
|
||||||
if (!settings[Constants.deepLinkPrefix] || !settings[Constants.joinStatusLink]) {
|
|
||||||
settings[Constants.deepLinkPrefix] = true
|
|
||||||
settings[Constants.joinStatusLink] = true
|
|
||||||
settingsUpdated = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const whitelistedHostnames = []
|
|
||||||
|
|
||||||
// Add whitelisted sites in to app settings that are not already there
|
|
||||||
whiteListedSites.forEach(site => {
|
|
||||||
if (!settings.hasOwnProperty(site.address)) {
|
|
||||||
settings[site.address] = false
|
|
||||||
settingsUpdated = true
|
|
||||||
}
|
|
||||||
whitelistedHostnames.push(site.address)
|
|
||||||
})
|
|
||||||
// Remove any whitelisted sites from app settings that don't exist in the
|
|
||||||
// whitelist from status-go
|
|
||||||
Object.keys(settings).forEach(settingsHostname => {
|
|
||||||
if (!whitelistedHostnames.includes(settingsHostname)) {
|
|
||||||
delete settings[settingsHostname]
|
|
||||||
settingsUpdated = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (settingsUpdated) {
|
|
||||||
localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Could not parse the whitelist for sites', e)
|
|
||||||
}
|
|
||||||
appMain.settingsLoaded()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: chatsModel
|
target: chatsModel
|
||||||
onNotificationClicked: {
|
onNotificationClicked: {
|
||||||
|
@ -784,8 +719,66 @@ Item {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
appView.currentIndex = localAccountSensitiveSettings.lastModeActiveTab
|
appView.currentIndex = localAccountSensitiveSettings.lastModeActiveTab
|
||||||
if(!!localAccountSensitiveSettings.lastModeActiveCommunity)
|
if(!!localAccountSensitiveSettings.lastModeActiveCommunity) {
|
||||||
chatsModel.communities.setActiveCommunity(localAccountSensitiveSettings.lastModeActiveCommunity)
|
chatsModel.communities.setActiveCommunity(localAccountSensitiveSettings.lastModeActiveCommunity)
|
||||||
|
}
|
||||||
|
// Since https://github.com/status-im/status-desktop/commit/93668ff75
|
||||||
|
// we're hiding the setting to change appearance for compact normal mode
|
||||||
|
// of the UI. For now, compact mode is the new default.
|
||||||
|
//
|
||||||
|
// Prior to this change, most likely many users are still using the
|
||||||
|
// normal mode configuration, so we have to enforce compact mode for
|
||||||
|
// those.
|
||||||
|
if (!localAccountSensitiveSettings.useCompactMode) {
|
||||||
|
localAccountSensitiveSettings.useCompactMode = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const whitelist = profileModel.getLinkPreviewWhitelist()
|
||||||
|
try {
|
||||||
|
const whiteListedSites = JSON.parse(whitelist)
|
||||||
|
let settingsUpdated = false
|
||||||
|
|
||||||
|
// Add Status links to whitelist
|
||||||
|
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
||||||
|
whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false})
|
||||||
|
let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
||||||
|
|
||||||
|
if (!settings) {
|
||||||
|
settings = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Status links as true. We intercept thoseURLs so it is privacy-safe
|
||||||
|
if (!settings[Constants.deepLinkPrefix] || !settings[Constants.joinStatusLink]) {
|
||||||
|
settings[Constants.deepLinkPrefix] = true
|
||||||
|
settings[Constants.joinStatusLink] = true
|
||||||
|
settingsUpdated = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const whitelistedHostnames = []
|
||||||
|
|
||||||
|
// Add whitelisted sites in to app settings that are not already there
|
||||||
|
whiteListedSites.forEach(site => {
|
||||||
|
if (!settings.hasOwnProperty(site.address)) {
|
||||||
|
settings[site.address] = false
|
||||||
|
settingsUpdated = true
|
||||||
|
}
|
||||||
|
whitelistedHostnames.push(site.address)
|
||||||
|
})
|
||||||
|
// Remove any whitelisted sites from app settings that don't exist in the
|
||||||
|
// whitelist from status-go
|
||||||
|
Object.keys(settings).forEach(settingsHostname => {
|
||||||
|
if (!whitelistedHostnames.includes(settingsHostname)) {
|
||||||
|
delete settings[settingsHostname]
|
||||||
|
settingsUpdated = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (settingsUpdated) {
|
||||||
|
localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Could not parse the whitelist for sites', e)
|
||||||
|
}
|
||||||
|
appMain.settingsLoaded()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*##^##
|
/*##^##
|
||||||
|
|
|
@ -131,7 +131,7 @@ Column {
|
||||||
}
|
}
|
||||||
return unfurledImageComponent
|
return unfurledImageComponent
|
||||||
} else {
|
} else {
|
||||||
if (isImageLink && index > 0) {
|
if (localAccountSensitiveSettings.neverAskAboutUnfurlingAgain || (isImageLink && index > 0)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,11 @@ Column {
|
||||||
}
|
}
|
||||||
if (linkWhiteListed) {
|
if (linkWhiteListed) {
|
||||||
if (fetched) {
|
if (fetched) {
|
||||||
return
|
if (linkData.communityId) {
|
||||||
|
return invitationBubble
|
||||||
|
}
|
||||||
|
|
||||||
|
return unfurledLinkComponent
|
||||||
}
|
}
|
||||||
fetched = true
|
fetched = true
|
||||||
|
|
||||||
|
@ -292,7 +296,7 @@ Column {
|
||||||
radius: 16
|
radius: 16
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: Style.current.border
|
border.color: Style.current.border
|
||||||
color:Style.current.background
|
color: Style.current.background
|
||||||
|
|
||||||
StatusFlatRoundButton {
|
StatusFlatRoundButton {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4ff2b6857c6af35da2337d729dc2ddf54c2e2c9c
|
Subproject commit f13364388b01b3aeb2d7bc451f70b516132aa57a
|
Loading…
Reference in New Issue