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
|
||||
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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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]) {
|
||||
|
|
Loading…
Reference in New Issue