{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/comments/180935051","pull_request_review_id":111415947,"id":180935051,"diff_hunk":"@@ -127,8 +127,9 @@ class BrowserFragment : IWebViewLifecycleFragment() {\n                         }\n                         NavigationEvent.VAL_UNCHECKED -> {\n                             url.toUri()?.let {\n-                                if (BundledTilesManager.getInstance(context).unpinSite(context, it)) {\n-                                    browserOverlay.removePinnedSiteFromTiles(it.toString())\n+                                val bundledTileId = BundledTilesManager.getInstance(context).unpinSite(context, it)\n+                                if (bundledTileId != null) {\n+                                    browserOverlay.removePinnedSiteFromTiles(bundledTileId)","path":"app/src/main/java/org/mozilla/focus/browser/BrowserFragment.kt","position":null,"original_position":8,"commit_id":"cdfba661c0a2a9e32266ad25ea18791e6406b91e","original_commit_id":"69b9d6d5c2f2bda54c83a46177cef2115175daf5","user":{"login":"liuche","id":1082253,"avatar_url":"https://avatars0.githubusercontent.com/u/1082253?v=4","gravatar_id":"","url":"https://api.github.com/users/liuche","html_url":"https://github.com/liuche","followers_url":"https://api.github.com/users/liuche/followers","following_url":"https://api.github.com/users/liuche/following{/other_user}","gists_url":"https://api.github.com/users/liuche/gists{/gist_id}","starred_url":"https://api.github.com/users/liuche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuche/subscriptions","organizations_url":"https://api.github.com/users/liuche/orgs","repos_url":"https://api.github.com/users/liuche/repos","events_url":"https://api.github.com/users/liuche/events{/privacy}","received_events_url":"https://api.github.com/users/liuche/received_events","type":"User","site_admin":false},"body":"This has some code smells here - it already more than doubles the previous code length, makes duplicate calls, and checks a bunch of cases. It also causes code complexity down the line (by making it handle two types of inputs) and also passes around `null` as an expected value that needs to be checked. (Using `null` to signal state is not a good idea). [You should read that Clean Code book :P ]\r\n\r\nCan you think of a cleaner way to structure this code?\r\n\r\nI'd encourage you not to \"just write code that works\" or \"fix problems created in previous commits\" - I think it's easy to do that, but if code looks messy, consider how you can clean it up.","created_at":"2018-04-12T00:21:26Z","updated_at":"2018-04-12T00:37:12Z","html_url":"https://github.com/mozilla-mobile/firefox-tv/pull/796#discussion_r180935051","pull_request_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/comments/180935051"},"html":{"href":"https://github.com/mozilla-mobile/firefox-tv/pull/796#discussion_r180935051"},"pull_request":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796","id":180746456,"html_url":"https://github.com/mozilla-mobile/firefox-tv/pull/796","diff_url":"https://github.com/mozilla-mobile/firefox-tv/pull/796.diff","patch_url":"https://github.com/mozilla-mobile/firefox-tv/pull/796.patch","issue_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/796","number":796,"state":"open","locked":false,"title":"Closes #768:  [Home] Combine layouts for home and overlay","user":{"login":"bkmunar","id":8356717,"avatar_url":"https://avatars2.githubusercontent.com/u/8356717?v=4","gravatar_id":"","url":"https://api.github.com/users/bkmunar","html_url":"https://github.com/bkmunar","followers_url":"https://api.github.com/users/bkmunar/followers","following_url":"https://api.github.com/users/bkmunar/following{/other_user}","gists_url":"https://api.github.com/users/bkmunar/gists{/gist_id}","starred_url":"https://api.github.com/users/bkmunar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkmunar/subscriptions","organizations_url":"https://api.github.com/users/bkmunar/orgs","repos_url":"https://api.github.com/users/bkmunar/repos","events_url":"https://api.github.com/users/bkmunar/events{/privacy}","received_events_url":"https://api.github.com/users/bkmunar/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-10T22:37:40Z","updated_at":"2018-04-12T00:37:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e39a59858191ee056c899746caacf6734106736f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796/commits","review_comments_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796/comments","review_comment_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/796/comments","statuses_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/statuses/cdfba661c0a2a9e32266ad25ea18791e6406b91e","head":{"label":"mozilla-mobile:bkmunar/consolidate","ref":"bkmunar/consolidate","sha":"cdfba661c0a2a9e32266ad25ea18791e6406b91e","user":{"login":"mozilla-mobile","id":22351667,"avatar_url":"https://avatars3.githubusercontent.com/u/22351667?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-mobile","html_url":"https://github.com/mozilla-mobile","followers_url":"https://api.github.com/users/mozilla-mobile/followers","following_url":"https://api.github.com/users/mozilla-mobile/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-mobile/subscriptions","organizations_url":"https://api.github.com/users/mozilla-mobile/orgs","repos_url":"https://api.github.com/users/mozilla-mobile/repos","events_url":"https://api.github.com/users/mozilla-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":114038082,"name":"firefox-tv","full_name":"mozilla-mobile/firefox-tv","owner":{"login":"mozilla-mobile","id":22351667,"avatar_url":"https://avatars3.githubusercontent.com/u/22351667?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-mobile","html_url":"https://github.com/mozilla-mobile","followers_url":"https://api.github.com/users/mozilla-mobile/followers","following_url":"https://api.github.com/users/mozilla-mobile/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-mobile/subscriptions","organizations_url":"https://api.github.com/users/mozilla-mobile/orgs","repos_url":"https://api.github.com/users/mozilla-mobile/repos","events_url":"https://api.github.com/users/mozilla-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-mobile/firefox-tv","description":"Firefox for Amazon's Fire TV","fork":false,"url":"https://api.github.com/repos/mozilla-mobile/firefox-tv","forks_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/forks","keys_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/teams","hooks_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/hooks","issue_events_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/events","assignees_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/tags","blobs_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/languages","stargazers_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/stargazers","contributors_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/contributors","subscribers_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/subscribers","subscription_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/subscription","commits_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/merges","archive_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/downloads","issues_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/deployments","created_at":"2017-12-12T20:53:46Z","updated_at":"2018-04-11T01:02:53Z","pushed_at":"2018-04-12T00:23:30Z","git_url":"git://github.com/mozilla-mobile/firefox-tv.git","ssh_url":"git@github.com:mozilla-mobile/firefox-tv.git","clone_url":"https://github.com/mozilla-mobile/firefox-tv.git","svn_url":"https://github.com/mozilla-mobile/firefox-tv","homepage":"https://blog.mozilla.org/blog/2017/12/20/firefox-is-now-on-amazon-fire-tv-happy-holiday-watching/","size":96792,"stargazers_count":16,"watchers_count":16,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":163,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":14,"open_issues":163,"watchers":16,"default_branch":"master"}},"base":{"label":"mozilla-mobile:master","ref":"master","sha":"1874a7d0b97aa98c7507b507879d45e028573bbf","user":{"login":"mozilla-mobile","id":22351667,"avatar_url":"https://avatars3.githubusercontent.com/u/22351667?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-mobile","html_url":"https://github.com/mozilla-mobile","followers_url":"https://api.github.com/users/mozilla-mobile/followers","following_url":"https://api.github.com/users/mozilla-mobile/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-mobile/subscriptions","organizations_url":"https://api.github.com/users/mozilla-mobile/orgs","repos_url":"https://api.github.com/users/mozilla-mobile/repos","events_url":"https://api.github.com/users/mozilla-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":114038082,"name":"firefox-tv","full_name":"mozilla-mobile/firefox-tv","owner":{"login":"mozilla-mobile","id":22351667,"avatar_url":"https://avatars3.githubusercontent.com/u/22351667?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-mobile","html_url":"https://github.com/mozilla-mobile","followers_url":"https://api.github.com/users/mozilla-mobile/followers","following_url":"https://api.github.com/users/mozilla-mobile/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-mobile/subscriptions","organizations_url":"https://api.github.com/users/mozilla-mobile/orgs","repos_url":"https://api.github.com/users/mozilla-mobile/repos","events_url":"https://api.github.com/users/mozilla-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-mobile/firefox-tv","description":"Firefox for Amazon's Fire TV","fork":false,"url":"https://api.github.com/repos/mozilla-mobile/firefox-tv","forks_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/forks","keys_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/teams","hooks_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/hooks","issue_events_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/events","assignees_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/tags","blobs_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/languages","stargazers_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/stargazers","contributors_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/contributors","subscribers_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/subscribers","subscription_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/subscription","commits_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/merges","archive_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/downloads","issues_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-mobile/firefox-tv/deployments","created_at":"2017-12-12T20:53:46Z","updated_at":"2018-04-11T01:02:53Z","pushed_at":"2018-04-12T00:23:30Z","git_url":"git://github.com/mozilla-mobile/firefox-tv.git","ssh_url":"git@github.com:mozilla-mobile/firefox-tv.git","clone_url":"https://github.com/mozilla-mobile/firefox-tv.git","svn_url":"https://github.com/mozilla-mobile/firefox-tv","homepage":"https://blog.mozilla.org/blog/2017/12/20/firefox-is-now-on-amazon-fire-tv-happy-holiday-watching/","size":96792,"stargazers_count":16,"watchers_count":16,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":163,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":14,"open_issues":163,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796"},"html":{"href":"https://github.com/mozilla-mobile/firefox-tv/pull/796"},"issue":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/796"},"comments":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/issues/796/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/pulls/796/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-mobile/firefox-tv/statuses/cdfba661c0a2a9e32266ad25ea18791e6406b91e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"liuche"}}