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

fix topsites never returning after exclusion #12806

Merged
merged 1 commit into from
Jan 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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