From c4094cd3646dd97aee3275573bd3be8780edc976 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Mon, 13 Mar 2017 10:40:15 +0100 Subject: [PATCH] Auto-include propagates correctly Resolves #7451 Auditors: @mrose17 Test Plan: - Enable payments in settings - Disable auto-include switch - Visit brianbondy.com in a new tab, site is added in the list and is not included --- app/ledger.js | 17 +++++++++++++---- .../preferences/payment/ledgerTable.js | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/ledger.js b/app/ledger.js index 0fede6932c3..3bcc5a97d9e 100644 --- a/app/ledger.js +++ b/app/ledger.js @@ -594,9 +594,14 @@ eventStore.addChangeListener(() => { pattern = `https?://${publisher}` initP = !synopsis.publishers[publisher] synopsis.initPublisher(publisher) - if ((initP) && (getSetting(settings.AUTO_SUGGEST_SITES))) { + if (initP) { excludeP(publisher, (unused, exclude) => { - appActions.changeSiteSetting(pattern, 'ledgerPayments', !exclude) + if (!getSetting(settings.AUTO_SUGGEST_SITES)) { + exclude = false + } else { + exclude = !exclude + } + appActions.changeSiteSetting(pattern, 'ledgerPayments', exclude) updatePublisherInfo() }) } @@ -981,8 +986,12 @@ var stickyP = (publisher) => { var result = (siteSetting) && (siteSetting.get('ledgerPayments')) // NB: legacy clean-up - if ((typeof result === 'undefined') && (typeof synopsis.publishers[publisher].options.stickyP !== 'undefined')) { - result = synopsis.publishers[publisher].options.stickyP + if (typeof result === 'undefined') { + if (typeof synopsis.publishers[publisher].options.stickyP !== 'undefined') { + result = synopsis.publishers[publisher].options.stickyP + } else { + result = true + } appActions.changeSiteSetting(pattern, 'ledgerPayments', result) } delete synopsis.publishers[publisher].options.stickyP diff --git a/app/renderer/components/preferences/payment/ledgerTable.js b/app/renderer/components/preferences/payment/ledgerTable.js index b235ae97b85..82f8f494194 100644 --- a/app/renderer/components/preferences/payment/ledgerTable.js +++ b/app/renderer/components/preferences/payment/ledgerTable.js @@ -59,7 +59,7 @@ class LedgerTable extends ImmutableComponent { return result } } - return true + return getSetting(settings.AUTO_SUGGEST_SITES, this.props.settings) } shouldShow (synopsis) { @@ -101,7 +101,7 @@ class LedgerTable extends ImmutableComponent { const publisherURL = synopsis.get('publisherURL') const percentage = synopsis.get('percentage') const site = synopsis.get('site') - const defaultSiteSetting = true + const defaultAutoInclude = this.enabledForSite(synopsis) return [ { @@ -131,7 +131,7 @@ class LedgerTable extends ImmutableComponent { { html: ,