fix(settings): fix whitelist setting that starts null
This commit is contained in:
parent
0d7d09e351
commit
499d99a185
|
@ -142,6 +142,9 @@ Column {
|
||||||
|
|
||||||
let linkWhiteListed = false
|
let linkWhiteListed = false
|
||||||
const linkHostname = Utils.getHostname(link)
|
const linkHostname = Utils.getHostname(link)
|
||||||
|
if (!localAccountSensitiveSettings.whitelistedUnfurlingSites) {
|
||||||
|
localAccountSensitiveSettings.whitelistedUnfurlingSites = {}
|
||||||
|
}
|
||||||
const linkExists = Object.keys(localAccountSensitiveSettings.whitelistedUnfurlingSites).some(function(whitelistedHostname) {
|
const linkExists = Object.keys(localAccountSensitiveSettings.whitelistedUnfurlingSites).some(function(whitelistedHostname) {
|
||||||
const exists = linkHostname.endsWith(whitelistedHostname)
|
const exists = linkHostname.endsWith(whitelistedHostname)
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
|
@ -23,6 +23,9 @@ ModalPopup {
|
||||||
|
|
||||||
function populatePreviewableSites() {
|
function populatePreviewableSites() {
|
||||||
let whitelist = JSON.parse(privacyModule.getLinkPreviewWhitelist())
|
let whitelist = JSON.parse(privacyModule.getLinkPreviewWhitelist())
|
||||||
|
if (!localAccountSensitiveSettings.whitelistedUnfurlingSites) {
|
||||||
|
localAccountSensitiveSettings.whitelistedUnfurlingSites = {}
|
||||||
|
}
|
||||||
whitelist.forEach(entry => {
|
whitelist.forEach(entry => {
|
||||||
entry.isWhitelisted = localAccountSensitiveSettings.whitelistedUnfurlingSites[entry.address] || false
|
entry.isWhitelisted = localAccountSensitiveSettings.whitelistedUnfurlingSites[entry.address] || false
|
||||||
previewableSites.append(entry)
|
previewableSites.append(entry)
|
||||||
|
@ -172,11 +175,16 @@ ModalPopup {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
onCheckedChanged: function () {
|
onCheckedChanged: function () {
|
||||||
if (localAccountSensitiveSettings.whitelistedUnfurlingSites[address] === this.checked) {
|
let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
||||||
|
|
||||||
|
if (!settings) {
|
||||||
|
settings = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings[address] === this.checked) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
|
||||||
settings[address] = this.checked
|
settings[address] = this.checked
|
||||||
localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
||||||
}
|
}
|
||||||
|
|
|
@ -527,7 +527,11 @@ Item {
|
||||||
// Add Status links to whitelist
|
// Add Status links to whitelist
|
||||||
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
||||||
whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, 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
|
// Set Status links as true. We intercept thoseURLs so it is privacy-safe
|
||||||
if (!settings[Constants.deepLinkPrefix] || !settings[Constants.joinStatusLink]) {
|
if (!settings[Constants.deepLinkPrefix] || !settings[Constants.joinStatusLink]) {
|
||||||
|
|
Loading…
Reference in New Issue