{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/comments/181838827","pull_request_review_id":112524877,"id":181838827,"diff_hunk":"@@ -0,0 +1,234 @@\n+// Copyright 2018 The Chromium Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style license that can be\n+// found in the LICENSE file.\n+'use strict';\n+\n+foam.CLASS({\n+  name: 'ToggleListElementsView',\n+  package: 'org.chromium.apis.web',\n+  extends: 'foam.u2.Element',\n+\n+  documentation: `A view for toggling a list of arbitrary elements. Similar to\n+      foam.u2.view.EditColumns view, but with a more consistent treatment of\n+      list elements and the slots that bind them.\n+\n+      Elements in the selectable and selected lists are identified by their name\n+      and use their label for rendering in UI. As such, list elements must each\n+      have both a unique name and a label.`,\n+\n+  requires: [\n+    'foam.u2.md.CheckBox'\n+  ],\n+  imports: ['error'],\n+  exports: [\n+    'selectable',\n+    'selected',\n+  ],\n+\n+  css: `\n+    ^item {\n+      display: flex;\n+    }\n+\n+    ^ .foam-u2-md-CheckBox {\n+      flex-shrink: 0;\n+    }\n+\n+    ^ .foam-u2-md-CheckBox-label {\n+      position: static;\n+    }\n+  `,\n+\n+  classes: [\n+    {\n+      name: 'ElementSlot',\n+      extends: 'foam.core.Slot',\n+\n+      documentation: `A custom foam.core.Slot implementation; each manages one\n+          element in the selected collection.`,\n+\n+      imports: [\n+        'selectable',\n+        'selected',\n+      ],\n+\n+      properties: [\n+        {\n+          class: 'Int',\n+          name: 'selectableIdx',\n+        },\n+      ],\n+\n+      methods: [\n+        function get() {\n+          const elem = this.selectable[this.selectableIdx];\n+          return this.selected.some(c => c.name === elem.name);\n+        },\n+        function set(value) {\n+          const prevValue = this.get();\n+          if (value) {\n+            this.addElement();\n+          } else {\n+            this.removeElement();\n+          }\n+          // Data binding depnds on an event being published on set. This is\n+          // automatically taken care of by property slots (with the\n+          // propertyChange event), but must be published manually for this\n+          // custom foam.core.Slot implementation.\n+          if (prevValue !== value) {\n+            this.pub('elementChange', this.selectableIdx, this);\n+          }\n+        },\n+        function getElement() {\n+          return this.selectable[this.selectableIdx];\n+        },\n+        function addElement() {\n+          const elem = this.selectable[this.selectableIdx];\n+          const able = this.selectable;\n+          const ed = this.selected;\n+          let iAble = 0;\n+          let iEd = 0;\n+          while (iAble <= this.selectableIdx) {\n+            if (iEd >= ed.length) {\n+              ed.push(elem);\n+              break;\n+            }\n+            if (iAble === this.selectableIdx) {\n+              ed.splice(iEd, 0, elem);\n+              break;\n+            }\n+\n+            if (able[iAble].name === ed[iEd].name) iEd++;\n+            iAble++;\n+          }\n+          this.selected = Array.from(ed);\n+        },\n+        function removeElement() {\n+          const elem = this.selectable[this.selectableIdx];\n+          const ed = this.selected;\n+          for (let i = 0; i < ed.length; i++) {\n+            if (ed[i].name === elem.name) {\n+              ed.splice(i, 1);\n+              i--;","path":"lib/u2/ToggleListElementsView.es6.js","position":112,"original_position":112,"commit_id":"f73205da555f598bfdb86639e203821b3a4db869","original_commit_id":"f73205da555f598bfdb86639e203821b3a4db869","user":{"login":"arobins","id":7801314,"avatar_url":"https://avatars2.githubusercontent.com/u/7801314?v=4","gravatar_id":"","url":"https://api.github.com/users/arobins","html_url":"https://github.com/arobins","followers_url":"https://api.github.com/users/arobins/followers","following_url":"https://api.github.com/users/arobins/following{/other_user}","gists_url":"https://api.github.com/users/arobins/gists{/gist_id}","starred_url":"https://api.github.com/users/arobins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arobins/subscriptions","organizations_url":"https://api.github.com/users/arobins/orgs","repos_url":"https://api.github.com/users/arobins/repos","events_url":"https://api.github.com/users/arobins/events{/privacy}","received_events_url":"https://api.github.com/users/arobins/received_events","type":"User","site_admin":false},"body":"This method should only be able to remove one element, so you could break here, right?\r\n\r\nAnd if so, could you not use find to get the index, and then feed that to splice?","created_at":"2018-04-16T18:21:28Z","updated_at":"2018-04-16T18:42:27Z","html_url":"https://github.com/GoogleChromeLabs/confluence/pull/275#discussion_r181838827","pull_request_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/comments/181838827"},"html":{"href":"https://github.com/GoogleChromeLabs/confluence/pull/275#discussion_r181838827"},"pull_request":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275","id":181715899,"html_url":"https://github.com/GoogleChromeLabs/confluence/pull/275","diff_url":"https://github.com/GoogleChromeLabs/confluence/pull/275.diff","patch_url":"https://github.com/GoogleChromeLabs/confluence/pull/275.patch","issue_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues/275","number":275,"state":"open","locked":false,"title":"Port DAO controller from mdn-confluence","user":{"login":"mdittmer","id":1775176,"avatar_url":"https://avatars3.githubusercontent.com/u/1775176?v=4","gravatar_id":"","url":"https://api.github.com/users/mdittmer","html_url":"https://github.com/mdittmer","followers_url":"https://api.github.com/users/mdittmer/followers","following_url":"https://api.github.com/users/mdittmer/following{/other_user}","gists_url":"https://api.github.com/users/mdittmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdittmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdittmer/subscriptions","organizations_url":"https://api.github.com/users/mdittmer/orgs","repos_url":"https://api.github.com/users/mdittmer/repos","events_url":"https://api.github.com/users/mdittmer/events{/privacy}","received_events_url":"https://api.github.com/users/mdittmer/received_events","type":"User","site_admin":false},"body":"The underlying views are tested using a manual UI test.","created_at":"2018-04-15T19:26:00Z","updated_at":"2018-04-16T18:42:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d65d933c025f78f6cbda4962a3bc1ed1be096b7","assignee":null,"assignees":[],"requested_reviewers":[{"login":"lukebjerring","id":777956,"avatar_url":"https://avatars2.githubusercontent.com/u/777956?v=4","gravatar_id":"","url":"https://api.github.com/users/lukebjerring","html_url":"https://github.com/lukebjerring","followers_url":"https://api.github.com/users/lukebjerring/followers","following_url":"https://api.github.com/users/lukebjerring/following{/other_user}","gists_url":"https://api.github.com/users/lukebjerring/gists{/gist_id}","starred_url":"https://api.github.com/users/lukebjerring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukebjerring/subscriptions","organizations_url":"https://api.github.com/users/lukebjerring/orgs","repos_url":"https://api.github.com/users/lukebjerring/repos","events_url":"https://api.github.com/users/lukebjerring/events{/privacy}","received_events_url":"https://api.github.com/users/lukebjerring/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275/commits","review_comments_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275/comments","review_comment_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues/275/comments","statuses_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/statuses/f73205da555f598bfdb86639e203821b3a4db869","head":{"label":"mdittmer:dao-controller","ref":"dao-controller","sha":"f73205da555f598bfdb86639e203821b3a4db869","user":{"login":"mdittmer","id":1775176,"avatar_url":"https://avatars3.githubusercontent.com/u/1775176?v=4","gravatar_id":"","url":"https://api.github.com/users/mdittmer","html_url":"https://github.com/mdittmer","followers_url":"https://api.github.com/users/mdittmer/followers","following_url":"https://api.github.com/users/mdittmer/following{/other_user}","gists_url":"https://api.github.com/users/mdittmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdittmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdittmer/subscriptions","organizations_url":"https://api.github.com/users/mdittmer/orgs","repos_url":"https://api.github.com/users/mdittmer/repos","events_url":"https://api.github.com/users/mdittmer/events{/privacy}","received_events_url":"https://api.github.com/users/mdittmer/received_events","type":"User","site_admin":false},"repo":{"id":108406200,"name":"confluence","full_name":"mdittmer/confluence","owner":{"login":"mdittmer","id":1775176,"avatar_url":"https://avatars3.githubusercontent.com/u/1775176?v=4","gravatar_id":"","url":"https://api.github.com/users/mdittmer","html_url":"https://github.com/mdittmer","followers_url":"https://api.github.com/users/mdittmer/followers","following_url":"https://api.github.com/users/mdittmer/following{/other_user}","gists_url":"https://api.github.com/users/mdittmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdittmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdittmer/subscriptions","organizations_url":"https://api.github.com/users/mdittmer/orgs","repos_url":"https://api.github.com/users/mdittmer/repos","events_url":"https://api.github.com/users/mdittmer/events{/privacy}","received_events_url":"https://api.github.com/users/mdittmer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mdittmer/confluence","description":"Service and API for Web API Confluence: Metrics for web platform health","fork":true,"url":"https://api.github.com/repos/mdittmer/confluence","forks_url":"https://api.github.com/repos/mdittmer/confluence/forks","keys_url":"https://api.github.com/repos/mdittmer/confluence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdittmer/confluence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdittmer/confluence/teams","hooks_url":"https://api.github.com/repos/mdittmer/confluence/hooks","issue_events_url":"https://api.github.com/repos/mdittmer/confluence/issues/events{/number}","events_url":"https://api.github.com/repos/mdittmer/confluence/events","assignees_url":"https://api.github.com/repos/mdittmer/confluence/assignees{/user}","branches_url":"https://api.github.com/repos/mdittmer/confluence/branches{/branch}","tags_url":"https://api.github.com/repos/mdittmer/confluence/tags","blobs_url":"https://api.github.com/repos/mdittmer/confluence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdittmer/confluence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdittmer/confluence/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdittmer/confluence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdittmer/confluence/statuses/{sha}","languages_url":"https://api.github.com/repos/mdittmer/confluence/languages","stargazers_url":"https://api.github.com/repos/mdittmer/confluence/stargazers","contributors_url":"https://api.github.com/repos/mdittmer/confluence/contributors","subscribers_url":"https://api.github.com/repos/mdittmer/confluence/subscribers","subscription_url":"https://api.github.com/repos/mdittmer/confluence/subscription","commits_url":"https://api.github.com/repos/mdittmer/confluence/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdittmer/confluence/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdittmer/confluence/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdittmer/confluence/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdittmer/confluence/contents/{+path}","compare_url":"https://api.github.com/repos/mdittmer/confluence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdittmer/confluence/merges","archive_url":"https://api.github.com/repos/mdittmer/confluence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdittmer/confluence/downloads","issues_url":"https://api.github.com/repos/mdittmer/confluence/issues{/number}","pulls_url":"https://api.github.com/repos/mdittmer/confluence/pulls{/number}","milestones_url":"https://api.github.com/repos/mdittmer/confluence/milestones{/number}","notifications_url":"https://api.github.com/repos/mdittmer/confluence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdittmer/confluence/labels{/name}","releases_url":"https://api.github.com/repos/mdittmer/confluence/releases{/id}","deployments_url":"https://api.github.com/repos/mdittmer/confluence/deployments","created_at":"2017-10-26T12:06:03Z","updated_at":"2017-10-26T12:06:05Z","pushed_at":"2018-04-15T21:22:01Z","git_url":"git://github.com/mdittmer/confluence.git","ssh_url":"git@github.com:mdittmer/confluence.git","clone_url":"https://github.com/mdittmer/confluence.git","svn_url":"https://github.com/mdittmer/confluence","homepage":"https://web-confluence.appspot.com","size":49833,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleChromeLabs:master","ref":"master","sha":"859262e02ce83f925d94d0ab3ccf0de0cca3067c","user":{"login":"GoogleChromeLabs","id":31970254,"avatar_url":"https://avatars1.githubusercontent.com/u/31970254?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChromeLabs","html_url":"https://github.com/GoogleChromeLabs","followers_url":"https://api.github.com/users/GoogleChromeLabs/followers","following_url":"https://api.github.com/users/GoogleChromeLabs/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChromeLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChromeLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChromeLabs/subscriptions","organizations_url":"https://api.github.com/users/GoogleChromeLabs/orgs","repos_url":"https://api.github.com/users/GoogleChromeLabs/repos","events_url":"https://api.github.com/users/GoogleChromeLabs/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChromeLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":82467989,"name":"confluence","full_name":"GoogleChromeLabs/confluence","owner":{"login":"GoogleChromeLabs","id":31970254,"avatar_url":"https://avatars1.githubusercontent.com/u/31970254?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChromeLabs","html_url":"https://github.com/GoogleChromeLabs","followers_url":"https://api.github.com/users/GoogleChromeLabs/followers","following_url":"https://api.github.com/users/GoogleChromeLabs/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChromeLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChromeLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChromeLabs/subscriptions","organizations_url":"https://api.github.com/users/GoogleChromeLabs/orgs","repos_url":"https://api.github.com/users/GoogleChromeLabs/repos","events_url":"https://api.github.com/users/GoogleChromeLabs/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChromeLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChromeLabs/confluence","description":"Service and API for Web API Confluence: Metrics for web platform health","fork":false,"url":"https://api.github.com/repos/GoogleChromeLabs/confluence","forks_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/forks","keys_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/teams","hooks_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/hooks","issue_events_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/events","assignees_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/tags","blobs_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/languages","stargazers_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/stargazers","contributors_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/contributors","subscribers_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/subscribers","subscription_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/subscription","commits_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/merges","archive_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/downloads","issues_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChromeLabs/confluence/deployments","created_at":"2017-02-19T15:16:33Z","updated_at":"2018-04-15T00:39:11Z","pushed_at":"2018-04-15T21:22:01Z","git_url":"git://github.com/GoogleChromeLabs/confluence.git","ssh_url":"git@github.com:GoogleChromeLabs/confluence.git","clone_url":"https://github.com/GoogleChromeLabs/confluence.git","svn_url":"https://github.com/GoogleChromeLabs/confluence","homepage":"https://web-confluence.appspot.com","size":25659,"stargazers_count":28,"watchers_count":28,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":63,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":18,"open_issues":63,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275"},"html":{"href":"https://github.com/GoogleChromeLabs/confluence/pull/275"},"issue":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues/275"},"comments":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/issues/275/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/pulls/275/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChromeLabs/confluence/statuses/f73205da555f598bfdb86639e203821b3a4db869"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"arobins"}}