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 #12806 from brave/topsites/excluded/10411
Browse files Browse the repository at this point in the history
fix topsites never returning after exclusion
  • Loading branch information
bsclifton authored Jan 23, 2018
2 parents ccd3684 + c77674e commit 4e6cbdd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/browser/api/topSites.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const isPinned = (state, siteKey) => {
})
}

const isIgnored = (state, siteKey) => {
return aboutNewTabState.getIgnoredTopSites(state).includes(siteKey)
}

const sortCountDescending = (left, right) => {
const leftCount = left.get('count', 0)
const rightCount = right.get('count', 0)
Expand Down Expand Up @@ -85,6 +89,7 @@ const getTopSiteData = () => {
let sites = historyState.getSites(state)
.filter((site, key) => !isSourceAboutUrl(site.get('location')) &&
!isPinned(state, key) &&
!isIgnored(state, key) &&
(minCountOfTopSites === undefined || (site.get('count') || 0) >= minCountOfTopSites) &&
(minAccessOfTopSites === undefined || (site.get('lastAccessedTime') || 0) >= minAccessOfTopSites)
)
Expand Down Expand Up @@ -118,7 +123,7 @@ const getTopSiteData = () => {
const preDefined = staticData
// TODO: this doesn't work properly
.filter((site) => {
return !isPinned(state, site.get('key'))
return !isPinned(state, site.get('key')) && !isIgnored(state, site.get('key'))
})
.map(site => {
const bookmarkKey = bookmarkLocationCache.getCacheKey(state, site.get('location'))
Expand Down

0 comments on commit 4e6cbdd

Please sign in to comment.