{"action":"created","comment":{"url":"https://api.github.com/repos/brave/brave-core/pulls/comments/239397622","pull_request_review_id":182168286,"id":239397622,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTM5NzYyMg==","diff_hunk":"@@ -447,34 +527,265 @@ void BookmarkChangeProcessor::ApplyChangesFromSyncModel(\n         }\n       }\n     } else if (sync_record->action == jslib::SyncRecord::Action::A_CREATE) {\n+      bool folder_was_created = false;\n+      const bookmarks::BookmarkNode* parent_node = nullptr;\n       if (!node) {\n         // TODO(bridiver) make sure there isn't an existing record for objectId\n-        const bookmarks::BookmarkNode* parent_node =\n-            FindParent(bookmark_model_, bookmark_record);\n+        parent_node =\n+            FindParent(bookmark_model_, bookmark_record, GetPendingNodeRoot());\n \n         const BookmarkNode* bookmark_bar = bookmark_model_->bookmark_bar_node();\n         bool bookmark_bar_was_empty = bookmark_bar->empty();\n+\n+        // Use manual, not bookmark_model_->AddXXX, add node/folder to avoid","path":"components/brave_sync/client/bookmark_change_processor.cc","position":234,"original_position":234,"commit_id":"064711d764d33f4b9126c6ef8dd6a5595624e4b1","original_commit_id":"064711d764d33f4b9126c6ef8dd6a5595624e4b1","user":{"login":"AlexeyBarabash","id":24739341,"node_id":"MDQ6VXNlcjI0NzM5MzQx","avatar_url":"https://avatars1.githubusercontent.com/u/24739341?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexeyBarabash","html_url":"https://github.com/AlexeyBarabash","followers_url":"https://api.github.com/users/AlexeyBarabash/followers","following_url":"https://api.github.com/users/AlexeyBarabash/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyBarabash/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyBarabash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyBarabash/subscriptions","organizations_url":"https://api.github.com/users/AlexeyBarabash/orgs","repos_url":"https://api.github.com/users/AlexeyBarabash/repos","events_url":"https://api.github.com/users/AlexeyBarabash/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyBarabash/received_events","type":"User","site_admin":false},"body":"Here the point is not about our observers, but other observers.\r\nOtherwise, I get the node `Pending nodes` visible on `brave://bookmarks` for the amount of time when it has children. Here I think, observer of JS bookmarks API is triggered. So disabled that observers in that way. \r\n\r\n","created_at":"2018-12-06T10:20:11Z","updated_at":"2018-12-06T10:20:12Z","html_url":"https://github.com/brave/brave-core/pull/982#discussion_r239397622","pull_request_url":"https://api.github.com/repos/brave/brave-core/pulls/982","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/brave/brave-core/pulls/comments/239397622"},"html":{"href":"https://github.com/brave/brave-core/pull/982#discussion_r239397622"},"pull_request":{"href":"https://api.github.com/repos/brave/brave-core/pulls/982"}},"in_reply_to_id":239273111},"pull_request":{"url":"https://api.github.com/repos/brave/brave-core/pulls/982","id":234694815,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0Njk0ODE1","html_url":"https://github.com/brave/brave-core/pull/982","diff_url":"https://github.com/brave/brave-core/pull/982.diff","patch_url":"https://github.com/brave/brave-core/pull/982.patch","issue_url":"https://api.github.com/repos/brave/brave-core/issues/982","number":982,"state":"open","locked":false,"title":"Sync folder structure not kept","user":{"login":"AlexeyBarabash","id":24739341,"node_id":"MDQ6VXNlcjI0NzM5MzQx","avatar_url":"https://avatars1.githubusercontent.com/u/24739341?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexeyBarabash","html_url":"https://github.com/AlexeyBarabash","followers_url":"https://api.github.com/users/AlexeyBarabash/followers","following_url":"https://api.github.com/users/AlexeyBarabash/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyBarabash/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyBarabash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyBarabash/subscriptions","organizations_url":"https://api.github.com/users/AlexeyBarabash/orgs","repos_url":"https://api.github.com/users/AlexeyBarabash/repos","events_url":"https://api.github.com/users/AlexeyBarabash/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyBarabash/received_events","type":"User","site_admin":false},"body":"Things done in PR:\r\n1) Orphaned bookmarks are placed to `Pending Bookmarks` folder and moved into actual parent folder once it arrived;\r\n2) `Pending Bookmarks` folder is hidden by using own AddFolder/AddUrl/Move model methods implementation which do not invokes observers for AddFolder/AddUrl or call AddXXX for Move when the bookmark item or folder belongs to 'Pending Bookmarks';\r\n3) Fixed sorting issue of bookmarks tree with a lot of mixed child items/folder;\r\n4) Added unit tests.\r\n\r\nFixes https://github.com/brave/brave-browser/issues/2133\r\n\r\n## Submitter Checklist:\r\n\r\n- [x] Submitted a [ticket](https://github.com/brave/brave-browser/issues) for my issue if one did not already exist.\r\n- [ ] Used Github [auto-closing keywords](https://help.github.com/articles/closing-issues-via-commit-messages/) in the commit message.\r\n- [x] Added/updated tests for this change (for new code or code which already has tests).\r\n- Verified that these changes build without errors on\r\n  - [ ] Windows\r\n  - [ ] macOS\r\n  - [x] Linux\r\n- Verified that these changes pass automated tests (`npm test brave_unit_tests && npm test brave_browser_tests`) on\r\n  - [ ] Windows\r\n  - [ ] macOS\r\n  - [x] Linux\r\n- [x] Ran `git rebase master` (if needed).\r\n- [x] Ran `git rebase -i` to squash commits (if needed).\r\n- [ ] Tagged reviewers and labelled the pull request as needed.\r\n- [ ] Request a security/privacy review as needed.\r\n- [ ] Add appropriate QA labels (QA/Yes or QA/No) to include the closed issue in milestone\r\n\r\n## Test Plan:\r\nManual is described in https://github.com/brave/brave-browser/issues/2133 .\r\nAuto tests: ``` npm run test -- brave_unit_tests --filter=BraveBookmarkChangeProcessorTest.ItemAheadOfFolder:BraveBookmarkChangeProcessorTest.ItemAheadOfFolderAgressive:BraveBookmarkChangeProcessorTest.ItemAheadOfFolderRequireStrictSorting:BraveBookmarkChangeProcessorTest.ItemAheadOfFolderObservers ```\r\n\r\n\r\n## Reviewer Checklist:\r\n\r\n- [ ] New files have MPL-2.0 license header.\r\n- [ ] Request a security/privacy review as needed.\r\n- [ ] Adequate test coverage exists to prevent regressions \r\n- [ ] Verify test plan is specified in PR before merging to source","created_at":"2018-11-29T16:06:53Z","updated_at":"2018-12-06T10:20:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b43b209b634e514d4fe0012448602e7bfd3048d5","assignee":{"login":"AlexeyBarabash","id":24739341,"node_id":"MDQ6VXNlcjI0NzM5MzQx","avatar_url":"https://avatars1.githubusercontent.com/u/24739341?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexeyBarabash","html_url":"https://github.com/AlexeyBarabash","followers_url":"https://api.github.com/users/AlexeyBarabash/followers","following_url":"https://api.github.com/users/AlexeyBarabash/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyBarabash/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyBarabash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyBarabash/subscriptions","organizations_url":"https://api.github.com/users/AlexeyBarabash/orgs","repos_url":"https://api.github.com/users/AlexeyBarabash/repos","events_url":"https://api.github.com/users/AlexeyBarabash/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyBarabash/received_events","type":"User","site_admin":false},"assignees":[{"login":"AlexeyBarabash","id":24739341,"node_id":"MDQ6VXNlcjI0NzM5MzQx","avatar_url":"https://avatars1.githubusercontent.com/u/24739341?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexeyBarabash","html_url":"https://github.com/AlexeyBarabash","followers_url":"https://api.github.com/users/AlexeyBarabash/followers","following_url":"https://api.github.com/users/AlexeyBarabash/following{/other_user}","gists_url":"https://api.github.com/users/AlexeyBarabash/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexeyBarabash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexeyBarabash/subscriptions","organizations_url":"https://api.github.com/users/AlexeyBarabash/orgs","repos_url":"https://api.github.com/users/AlexeyBarabash/repos","events_url":"https://api.github.com/users/AlexeyBarabash/events{/privacy}","received_events_url":"https://api.github.com/users/AlexeyBarabash/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"bridiver","id":34129,"node_id":"MDQ6VXNlcjM0MTI5","avatar_url":"https://avatars3.githubusercontent.com/u/34129?v=4","gravatar_id":"","url":"https://api.github.com/users/bridiver","html_url":"https://github.com/bridiver","followers_url":"https://api.github.com/users/bridiver/followers","following_url":"https://api.github.com/users/bridiver/following{/other_user}","gists_url":"https://api.github.com/users/bridiver/gists{/gist_id}","starred_url":"https://api.github.com/users/bridiver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bridiver/subscriptions","organizations_url":"https://api.github.com/users/bridiver/orgs","repos_url":"https://api.github.com/users/bridiver/repos","events_url":"https://api.github.com/users/bridiver/events{/privacy}","received_events_url":"https://api.github.com/users/bridiver/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":746102400,"node_id":"MDU6TGFiZWw3NDYxMDI0MDA=","url":"https://api.github.com/repos/brave/brave-core/labels/bug","name":"bug","color":"ee0701","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/brave/brave-core/pulls/982/commits","review_comments_url":"https://api.github.com/repos/brave/brave-core/pulls/982/comments","review_comment_url":"https://api.github.com/repos/brave/brave-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/brave/brave-core/issues/982/comments","statuses_url":"https://api.github.com/repos/brave/brave-core/statuses/064711d764d33f4b9126c6ef8dd6a5595624e4b1","head":{"label":"brave:sync_folder_structure_not_kept","ref":"sync_folder_structure_not_kept","sha":"064711d764d33f4b9126c6ef8dd6a5595624e4b1","user":{"login":"brave","id":12301619,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMzAxNjE5","avatar_url":"https://avatars1.githubusercontent.com/u/12301619?v=4","gravatar_id":"","url":"https://api.github.com/users/brave","html_url":"https://github.com/brave","followers_url":"https://api.github.com/users/brave/followers","following_url":"https://api.github.com/users/brave/following{/other_user}","gists_url":"https://api.github.com/users/brave/gists{/gist_id}","starred_url":"https://api.github.com/users/brave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brave/subscriptions","organizations_url":"https://api.github.com/users/brave/orgs","repos_url":"https://api.github.com/users/brave/repos","events_url":"https://api.github.com/users/brave/events{/privacy}","received_events_url":"https://api.github.com/users/brave/received_events","type":"Organization","site_admin":false},"repo":{"id":110198384,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAxOTgzODQ=","name":"brave-core","full_name":"brave/brave-core","private":false,"owner":{"login":"brave","id":12301619,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMzAxNjE5","avatar_url":"https://avatars1.githubusercontent.com/u/12301619?v=4","gravatar_id":"","url":"https://api.github.com/users/brave","html_url":"https://github.com/brave","followers_url":"https://api.github.com/users/brave/followers","following_url":"https://api.github.com/users/brave/following{/other_user}","gists_url":"https://api.github.com/users/brave/gists{/gist_id}","starred_url":"https://api.github.com/users/brave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brave/subscriptions","organizations_url":"https://api.github.com/users/brave/orgs","repos_url":"https://api.github.com/users/brave/repos","events_url":"https://api.github.com/users/brave/events{/privacy}","received_events_url":"https://api.github.com/users/brave/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/brave/brave-core","description":"Core engine for the Brave browser for macOS, Windows, Linux, and eventually Android. For the issue log, please see https://github.com/brave/brave-browser","fork":false,"url":"https://api.github.com/repos/brave/brave-core","forks_url":"https://api.github.com/repos/brave/brave-core/forks","keys_url":"https://api.github.com/repos/brave/brave-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brave/brave-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brave/brave-core/teams","hooks_url":"https://api.github.com/repos/brave/brave-core/hooks","issue_events_url":"https://api.github.com/repos/brave/brave-core/issues/events{/number}","events_url":"https://api.github.com/repos/brave/brave-core/events","assignees_url":"https://api.github.com/repos/brave/brave-core/assignees{/user}","branches_url":"https://api.github.com/repos/brave/brave-core/branches{/branch}","tags_url":"https://api.github.com/repos/brave/brave-core/tags","blobs_url":"https://api.github.com/repos/brave/brave-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brave/brave-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brave/brave-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/brave/brave-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brave/brave-core/statuses/{sha}","languages_url":"https://api.github.com/repos/brave/brave-core/languages","stargazers_url":"https://api.github.com/repos/brave/brave-core/stargazers","contributors_url":"https://api.github.com/repos/brave/brave-core/contributors","subscribers_url":"https://api.github.com/repos/brave/brave-core/subscribers","subscription_url":"https://api.github.com/repos/brave/brave-core/subscription","commits_url":"https://api.github.com/repos/brave/brave-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/brave/brave-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/brave/brave-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/brave/brave-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/brave/brave-core/contents/{+path}","compare_url":"https://api.github.com/repos/brave/brave-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brave/brave-core/merges","archive_url":"https://api.github.com/repos/brave/brave-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brave/brave-core/downloads","issues_url":"https://api.github.com/repos/brave/brave-core/issues{/number}","pulls_url":"https://api.github.com/repos/brave/brave-core/pulls{/number}","milestones_url":"https://api.github.com/repos/brave/brave-core/milestones{/number}","notifications_url":"https://api.github.com/repos/brave/brave-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brave/brave-core/labels{/name}","releases_url":"https://api.github.com/repos/brave/brave-core/releases{/id}","deployments_url":"https://api.github.com/repos/brave/brave-core/deployments","created_at":"2017-11-10T03:33:30Z","updated_at":"2018-12-06T09:24:07Z","pushed_at":"2018-12-06T10:09:25Z","git_url":"git://github.com/brave/brave-core.git","ssh_url":"git@github.com:brave/brave-core.git","clone_url":"https://github.com/brave/brave-core.git","svn_url":"https://github.com/brave/brave-core","homepage":"","size":62138,"stargazers_count":218,"watchers_count":218,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":53,"mirror_url":null,"archived":false,"open_issues_count":35,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":53,"open_issues":35,"watchers":218,"default_branch":"master"}},"base":{"label":"brave:master","ref":"master","sha":"a00145141cfcc32c063ec3eeefa8a97b3ed4345b","user":{"login":"brave","id":12301619,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMzAxNjE5","avatar_url":"https://avatars1.githubusercontent.com/u/12301619?v=4","gravatar_id":"","url":"https://api.github.com/users/brave","html_url":"https://github.com/brave","followers_url":"https://api.github.com/users/brave/followers","following_url":"https://api.github.com/users/brave/following{/other_user}","gists_url":"https://api.github.com/users/brave/gists{/gist_id}","starred_url":"https://api.github.com/users/brave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brave/subscriptions","organizations_url":"https://api.github.com/users/brave/orgs","repos_url":"https://api.github.com/users/brave/repos","events_url":"https://api.github.com/users/brave/events{/privacy}","received_events_url":"https://api.github.com/users/brave/received_events","type":"Organization","site_admin":false},"repo":{"id":110198384,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAxOTgzODQ=","name":"brave-core","full_name":"brave/brave-core","private":false,"owner":{"login":"brave","id":12301619,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMzAxNjE5","avatar_url":"https://avatars1.githubusercontent.com/u/12301619?v=4","gravatar_id":"","url":"https://api.github.com/users/brave","html_url":"https://github.com/brave","followers_url":"https://api.github.com/users/brave/followers","following_url":"https://api.github.com/users/brave/following{/other_user}","gists_url":"https://api.github.com/users/brave/gists{/gist_id}","starred_url":"https://api.github.com/users/brave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brave/subscriptions","organizations_url":"https://api.github.com/users/brave/orgs","repos_url":"https://api.github.com/users/brave/repos","events_url":"https://api.github.com/users/brave/events{/privacy}","received_events_url":"https://api.github.com/users/brave/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/brave/brave-core","description":"Core engine for the Brave browser for macOS, Windows, Linux, and eventually Android. For the issue log, please see https://github.com/brave/brave-browser","fork":false,"url":"https://api.github.com/repos/brave/brave-core","forks_url":"https://api.github.com/repos/brave/brave-core/forks","keys_url":"https://api.github.com/repos/brave/brave-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brave/brave-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brave/brave-core/teams","hooks_url":"https://api.github.com/repos/brave/brave-core/hooks","issue_events_url":"https://api.github.com/repos/brave/brave-core/issues/events{/number}","events_url":"https://api.github.com/repos/brave/brave-core/events","assignees_url":"https://api.github.com/repos/brave/brave-core/assignees{/user}","branches_url":"https://api.github.com/repos/brave/brave-core/branches{/branch}","tags_url":"https://api.github.com/repos/brave/brave-core/tags","blobs_url":"https://api.github.com/repos/brave/brave-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brave/brave-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brave/brave-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/brave/brave-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brave/brave-core/statuses/{sha}","languages_url":"https://api.github.com/repos/brave/brave-core/languages","stargazers_url":"https://api.github.com/repos/brave/brave-core/stargazers","contributors_url":"https://api.github.com/repos/brave/brave-core/contributors","subscribers_url":"https://api.github.com/repos/brave/brave-core/subscribers","subscription_url":"https://api.github.com/repos/brave/brave-core/subscription","commits_url":"https://api.github.com/repos/brave/brave-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/brave/brave-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/brave/brave-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/brave/brave-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/brave/brave-core/contents/{+path}","compare_url":"https://api.github.com/repos/brave/brave-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brave/brave-core/merges","archive_url":"https://api.github.com/repos/brave/brave-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brave/brave-core/downloads","issues_url":"https://api.github.com/repos/brave/brave-core/issues{/number}","pulls_url":"https://api.github.com/repos/brave/brave-core/pulls{/number}","milestones_url":"https://api.github.com/repos/brave/brave-core/milestones{/number}","notifications_url":"https://api.github.com/repos/brave/brave-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brave/brave-core/labels{/name}","releases_url":"https://api.github.com/repos/brave/brave-core/releases{/id}","deployments_url":"https://api.github.com/repos/brave/brave-core/deployments","created_at":"2017-11-10T03:33:30Z","updated_at":"2018-12-06T09:24:07Z","pushed_at":"2018-12-06T10:09:25Z","git_url":"git://github.com/brave/brave-core.git","ssh_url":"git@github.com:brave/brave-core.git","clone_url":"https://github.com/brave/brave-core.git","svn_url":"https://github.com/brave/brave-core","homepage":"","size":62138,"stargazers_count":218,"watchers_count":218,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":53,"mirror_url":null,"archived":false,"open_issues_count":35,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":53,"open_issues":35,"watchers":218,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/brave/brave-core/pulls/982"},"html":{"href":"https://github.com/brave/brave-core/pull/982"},"issue":{"href":"https://api.github.com/repos/brave/brave-core/issues/982"},"comments":{"href":"https://api.github.com/repos/brave/brave-core/issues/982/comments"},"review_comments":{"href":"https://api.github.com/repos/brave/brave-core/pulls/982/comments"},"review_comment":{"href":"https://api.github.com/repos/brave/brave-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/brave/brave-core/pulls/982/commits"},"statuses":{"href":"https://api.github.com/repos/brave/brave-core/statuses/064711d764d33f4b9126c6ef8dd6a5595624e4b1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"AlexeyBarabash"}}