Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #9952 from brave/ledger-9938
Browse files Browse the repository at this point in the history
Do not delete exclusion's list website if enabled by publisherToggle
  • Loading branch information
bsclifton committed Jul 11, 2017
1 parent acbfc37 commit cdad5e4
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,20 +1050,37 @@ var visibleP = (publisher) => {
synopsis.options.showOnlyVerified = getSetting(settings.PAYMENTS_NON_VERIFIED)
}

const publisherOptions = synopsis.publishers[publisher].options
const onlyVerified = !synopsis.options.showOnlyVerified

return (
eligibleP(publisher) &&
(
synopsis.publishers[publisher].options.exclude !== true ||
stickyP(publisher)
) &&
(
(onlyVerified && synopsis.publishers[publisher].options && synopsis.publishers[publisher].options.verified) ||
!onlyVerified
)
) &&
!blockedP(publisher)
// Publisher Options
const excludedByUser = blockedP(publisher)
const eligibleByPublisherToggle = stickyP(publisher) != null
const eligibleByNumberOfVisits = eligibleP(publisher)
const isInExclusionList = publisherOptions && publisherOptions.exclude
const verifiedPublisher = publisherOptions && publisherOptions.verified

// websites not included in exclusion list are eligible by number of visits
// but can be enabled by user action in the publisher toggle
const isEligible = (eligibleByNumberOfVisits && !isInExclusionList) || eligibleByPublisherToggle

// If user decide to remove the website, don't show it.
if (excludedByUser) {
return false
}

// Unless user decided to enable publisher with publisherToggle,
// do not show exclusion list.
if (!eligibleByPublisherToggle && isInExclusionList) {
return false
}

// If verified option is set, only show verified publishers
if (isEligible && onlyVerified) {
return verifiedPublisher
}

return isEligible
}

var contributeP = (publisher) => {
Expand Down

0 comments on commit cdad5e4

Please sign in to comment.