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

Remove Brave software links from urlbar suggestions #7692

Merged
merged 2 commits into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
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
15 changes: 3 additions & 12 deletions js/data/newTabData.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,7 @@ const iconPath = getBraveExtUrl('img/newtab/defaultTopSitesIcon')
*/
const now = Date.now()

module.exports.pinnedTopSites = [
{
"count": 1,
"favicon": `${iconPath}/twitter.png`,
"lastAccessedTime": now,
"location": "https://twitter.com/brave",
"partitionNumber": 0,
"tags": [],
"themeColor": "rgb(255, 255, 255)",
"title": "Brave Software (@brave) | Twitter"
}
]
module.exports.pinnedTopSites = []

module.exports.topSites = [
{
Expand Down Expand Up @@ -80,3 +69,5 @@ module.exports.topSites = [
"title": "Brave Browser: Fast AdBlock – Apps para Android no Google Play"
}
]

module.exports.topSiteLocations = module.exports.topSites.map((site) => site.location)
14 changes: 13 additions & 1 deletion js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const Filtering = require('../../app/filtering')
const basicAuth = require('../../app/browser/basicAuth')
const webtorrent = require('../../app/browser/webtorrent')
const windows = require('../../app/browser/windows')
const { topSiteLocations } = require('../data/newTabData')
const assert = require('assert')

// state helpers
Expand Down Expand Up @@ -421,9 +422,20 @@ const handleAppAction = (action) => {
appState = appState.set('passwords', new Immutable.List())
break
case appConstants.APP_CHANGE_NEW_TAB_DETAIL:
// If a site is pinned, add it to the sites if it isn't already there.
if (action.newTabPageDetail) {
let pinnedTopSites = action.newTabPageDetail.get('pinnedTopSites')
if (pinnedTopSites) {
pinnedTopSites.forEach((site) => {
if (site && topSiteLocations.includes(site.get('location'))) {
appState = appState.set('sites', siteUtil.addSite(appState.get('sites'), site))
}
})
}
}
appState = aboutNewTabState.mergeDetails(appState, action)
if (action.refresh) {
appState = aboutNewTabState.setSites(appState, action)
appState = aboutNewTabState.setSites(appState)
}
break
case appConstants.APP_POPULATE_HISTORY:
Expand Down