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

Commit

Permalink
Don't reupload bookmarks to Sync every load
Browse files Browse the repository at this point in the history
Fix #8408

Auditors: @diracdeltas @bbondy

Test Plan:
1. Open Brave and enable Sync.
2. Visit archive.org and bookmark it. Terminal should show that it synced.
3. Close archive.org tab.
4. Restart Brave.
5. Examine terminal. Bookmark shouldn't be re-synced.
  • Loading branch information
ayumi committed Apr 20, 2017
1 parent 15b4dbc commit 46de475
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,19 @@ module.exports.onSyncReady = (isFirstRun, e) => {
* @param {Immutable.Map} site
*/
const folderToObjectId = {}
const syncBookmark = (site) => {
if (!site || (site.get('objectId') && seed.equals(site.get('originalSeed'))) ||
folderToObjectId[site.get('folderId')] || !syncUtil.isSyncable('bookmark', site)) {
return
const shouldSyncBookmark = (site) => {
if (!site) { return false }
// originalSeed is set on reset to prevent synced bookmarks on a device
// from being re-synced.
const originalSeed = site.get('originalSeed')
if (site.get('objectId') && (!originalSeed || seed.equals(originalSeed))) {
return false
}
if (folderToObjectId[site.get('folderId')]) { return false }
return syncUtil.isSyncable('bookmark', site)
}
const syncBookmark = (site) => {
if (!shouldSyncBookmark(site)) { return }

const siteJS = site.toJS()

Expand Down

0 comments on commit 46de475

Please sign in to comment.