diff --git a/ui/app/AppLayouts/Chat/views/LinksMessageView.qml b/ui/app/AppLayouts/Chat/views/LinksMessageView.qml index ea217fbbfd..ea476d235c 100644 --- a/ui/app/AppLayouts/Chat/views/LinksMessageView.qml +++ b/ui/app/AppLayouts/Chat/views/LinksMessageView.qml @@ -142,6 +142,9 @@ Column { let linkWhiteListed = false const linkHostname = Utils.getHostname(link) + if (!localAccountSensitiveSettings.whitelistedUnfurlingSites) { + localAccountSensitiveSettings.whitelistedUnfurlingSites = {} + } const linkExists = Object.keys(localAccountSensitiveSettings.whitelistedUnfurlingSites).some(function(whitelistedHostname) { const exists = linkHostname.endsWith(whitelistedHostname) if (exists) { diff --git a/ui/app/AppLayouts/Profile/popups/ChatLinksPreviewModal.qml b/ui/app/AppLayouts/Profile/popups/ChatLinksPreviewModal.qml index b18947510b..0277cea554 100644 --- a/ui/app/AppLayouts/Profile/popups/ChatLinksPreviewModal.qml +++ b/ui/app/AppLayouts/Profile/popups/ChatLinksPreviewModal.qml @@ -23,6 +23,9 @@ ModalPopup { function populatePreviewableSites() { let whitelist = JSON.parse(privacyModule.getLinkPreviewWhitelist()) + if (!localAccountSensitiveSettings.whitelistedUnfurlingSites) { + localAccountSensitiveSettings.whitelistedUnfurlingSites = {} + } whitelist.forEach(entry => { entry.isWhitelisted = localAccountSensitiveSettings.whitelistedUnfurlingSites[entry.address] || false previewableSites.append(entry) @@ -172,11 +175,16 @@ ModalPopup { anchors.right: parent.right anchors.rightMargin: Style.current.padding onCheckedChanged: function () { - if (localAccountSensitiveSettings.whitelistedUnfurlingSites[address] === this.checked) { + let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites + + if (!settings) { + settings = {} + } + + if (settings[address] === this.checked) { return } - const settings = localAccountSensitiveSettings.whitelistedUnfurlingSites settings[address] = this.checked localAccountSensitiveSettings.whitelistedUnfurlingSites = settings } diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 03ef81fdac..8d6881bf5d 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -527,7 +527,11 @@ Item { // Add Status links to whitelist whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false}) whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false}) - const settings = localAccountSensitiveSettings.whitelistedUnfurlingSites + 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]) {