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

Commit

Permalink
Revert changes made in #7692 until we have a plan of attack
Browse files Browse the repository at this point in the history
(see #7717 for more info)

This PR:
- Reverts "Remove Brave software links from urlbar suggestions" (commit fa2eb80)
- Reverts "Since new list is cleared after a visit, let's not have any default pinned sites." (commit 34e6be4)
- Reverts "Actually remove Brave software links from history" (commit 3ef5da3)

Auditors: @diracdeltas, @bradleyrichter
  • Loading branch information
bsclifton committed Mar 16, 2017
1 parent 05b0622 commit e23e251
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
16 changes: 15 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ const getSetting = require('../js/settings').getSetting
const promisify = require('../js/lib/promisify')
const sessionStorageName = `session-store-${sessionStorageVersion}`

const getTopSiteMap = () => {
if (Array.isArray(topSites) && topSites.length) {
let siteMap = {}
let order = 0
topSites.forEach((site) => {
let key = siteUtil.getSiteKey(Immutable.fromJS(site))
site.order = order++
siteMap[key] = site
})
return siteMap
}
return {}
}

const getStoragePath = () => {
return path.join(app.getPath('userData'), sessionStorageName)
}
Expand Down Expand Up @@ -510,7 +524,7 @@ module.exports.defaultAppState = () => {
sync: {
lastFetchTimestamp: 0
},
sites: {},
sites: getTopSiteMap(),
tabs: [],
windows: [],
extensions: {},
Expand Down
15 changes: 12 additions & 3 deletions js/data/newTabData.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ const iconPath = getBraveExtUrl('img/newtab/defaultTopSitesIcon')
*/
const now = Date.now()

module.exports.pinnedTopSites = []
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.topSites = [
{
Expand Down Expand Up @@ -69,5 +80,3 @@ 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: 1 addition & 13 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ 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 @@ -422,20 +421,9 @@ 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)
appState = aboutNewTabState.setSites(appState, action)
}
break
case appConstants.APP_POPULATE_HISTORY:
Expand Down

0 comments on commit e23e251

Please sign in to comment.