Skip to content

Commit

Permalink
Send other_node children moving records for other desktops to catch up
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Feb 8, 2020
1 parent c136ae1 commit 1d9024a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/brave_sync/brave_profile_sync_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ void BraveProfileSyncServiceImpl::ProcessOtherBookmarksFolder(

// Add records to move direct children of other_node to this new folder
// with existing object id of the old "Other Bookmarks" folder
auto records_to_send = std::make_unique<RecordsList>();
for (size_t i = 0; i < model_->other_node()->children().size(); ++i) {
auto sync_record =
BookmarkNodeToSyncBookmark(model_->other_node()->children()[i].get());
Expand All @@ -871,10 +872,18 @@ void BraveProfileSyncServiceImpl::ProcessOtherBookmarksFolder(
bookmark.order + "." + std::to_string(i + 1);
LoadSyncEntityInfo(sync_record.get());

auto record_to_send = SyncRecord::Clone(*sync_record);

// Append chnages to remote records
if (!pending_received_records_)
pending_received_records_ = std::make_unique<RecordsList>();
pending_received_records_->push_back(std::move(sync_record));

// Send changes to other desktops
records_to_send->push_back(std::move(record_to_send));
}
SendSyncRecords(jslib_const::SyncRecordType_BOOKMARKS,
std::move(records_to_send));
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions components/brave_sync/brave_profile_sync_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ class BraveProfileSyncServiceImpl
void LoadSyncEntityInfo(jslib::SyncRecord* record);

bool IsOtherBookmarksFolder(const jslib::SyncRecord* record) const;
// Handling "Other Bookmarks" remote records
void ProcessOtherBookmarksFolder(const jslib::SyncRecord* record,
bool* pass_to_syncer);
// Handling direct children of "Other Bookmarks" remote records
void ProcessOtherBookmarksChildren(jslib::SyncRecord* record);
// Check and correct info before sending records
void CheckOtherBookmarkRecord(jslib::SyncRecord* record);
void CheckOtherBookmarkChildRecord(jslib::SyncRecord* record);

Expand Down

0 comments on commit 1d9024a

Please sign in to comment.