{"action":"created","comment":{"url":"https://api.github.com/repos/zendesk/notification_app/pulls/comments/196639657","pull_request_review_id":130229875,"id":196639657,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjYzOTY1Nw==","diff_hunk":"@@ -0,0 +1,248 @@\n+/**\n+ * This component expects:\n+ * templates/datalist.hdbs\n+ */\n+\n+import { appResize } from './helpers'\n+import { find, findIndex, debounce } from 'lodash'\n+import $ from 'jquery/src/core'\n+import 'jquery/src/effects'\n+\n+/**\n+ * Events\n+ */\n+function getEventDatalistId (event) {\n+  return $(event.currentTarget).parents('div.datalist').data('id')\n+}\n+\n+var filterGroupList = debounce((event) => {\n+  const id = getEventDatalistId(event)\n+  getDatalist(id).filterGroupList(event)\n+}, 100)\n+\n+var openCloseEvent = debounce((event) => {\n+  const id = getEventDatalistId(event)\n+  getDatalist(id).openCloseEvent(event)\n+}, 250, { leading: true, trailing: false })\n+\n+$(document).on('click', '.datalist .group_selector', openCloseEvent)\n+$(document).on('focus', '.datalist .group_selector', openCloseEvent)\n+$(document).on('blur', '.datalist .group_selector', openCloseEvent)\n+$(document).on('keyup', '.datalist .group_selector input', filterGroupList)\n+$(document).on('keypress', '.datalist .group_selector input', filterGroupList)\n+$(document).on('click', '.datalist .group_selector_list li', (event) => {\n+  const id = getEventDatalistId(event)\n+  getDatalist(id).addGroupToTags(event)\n+})\n+$(document).on('click', '.datalist .group_selector_tags li button.c-tag__remove', (event) => {\n+  const id = getEventDatalistId(event)\n+  getDatalist(id).removeGroupFromTags(event)\n+})\n+\n+/**\n+ * Array of all initiated datalists\n+ */\n+const datalists = []\n+export function getDatalist (id) {\n+  const datalist = find(datalists, (datalist) => {\n+    return datalist.id === id\n+  })\n+  return datalist\n+}\n+export function removeDatalist (id) {\n+  const idx = findIndex(datalists, (datalist) => {\n+    return datalist.id === id\n+  })\n+  if (idx === -1) throw new Error('Datalist not found')\n+  datalists.splice(idx, 1)\n+}\n+\n+/**\n+ * Datalist Class\n+ */\n+export default class Datalist {\n+  constructor (id, groups) {\n+    if (getDatalist(id)) {\n+      removeDatalist(id)\n+    }\n+\n+    this.id = id\n+    this.groups = groups.map((group) => {\n+      return { id: group.id, name: group.name, isVisible: true }\n+    })\n+\n+    datalists.push(this)\n+  }\n+\n+  $datalist () {\n+    if (!this._$datalist) {\n+      this._$datalist = $(`.datalist[data-id=\"${this.id}\"]`)\n+    }\n+    return this._$datalist\n+  }\n+\n+  valueOf () {\n+    return render(this.id, this.groups)\n+  }\n+\n+  openCloseEvent (event) {\n+    if (event.target.classList.contains('c-tag__remove')) return\n+    if (event.type === 'focusin') {\n+      this.showGroupList()\n+    } else {\n+      const isVisible = this.$datalist().find('.group_selector').hasClass('is-open')\n+      if (isVisible) this.hideGroupList()\n+      else this.showGroupList()\n+    }\n+  }\n+\n+  filterGroupList (event) {\n+    if (event.which === 13) return\n+\n+    const $datalist = this.$datalist()\n+    const $input = $datalist.find('.group_selector input')\n+    const text = $input.val().toLowerCase().trim()\n+    const regexp = new RegExp(text)\n+\n+    $datalist.find('.group_selector_list li').get().forEach((li) => {\n+      if (!text) return $(li).show()\n+      if (!regexp.test(li.textContent.toLowerCase())) {\n+        $(li).hide()\n+      } else {\n+        $(li).show()\n+      }\n+    })\n+  }\n+\n+  addGroupToTags (event) {","path":"src/javascript/lib/datalist.js","position":117,"original_position":117,"commit_id":"bef2ac1167cd4b76db88f66debaa38a11eedf903","original_commit_id":"bef2ac1167cd4b76db88f66debaa38a11eedf903","user":{"login":"vaevictis","id":321064,"node_id":"MDQ6VXNlcjMyMTA2NA==","avatar_url":"https://avatars1.githubusercontent.com/u/321064?v=4","gravatar_id":"","url":"https://api.github.com/users/vaevictis","html_url":"https://github.com/vaevictis","followers_url":"https://api.github.com/users/vaevictis/followers","following_url":"https://api.github.com/users/vaevictis/following{/other_user}","gists_url":"https://api.github.com/users/vaevictis/gists{/gist_id}","starred_url":"https://api.github.com/users/vaevictis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaevictis/subscriptions","organizations_url":"https://api.github.com/users/vaevictis/orgs","repos_url":"https://api.github.com/users/vaevictis/repos","events_url":"https://api.github.com/users/vaevictis/events{/privacy}","received_events_url":"https://api.github.com/users/vaevictis/received_events","type":"User","site_admin":false},"body":"Rename Group to something more generic. Option?\r\nSame for tags: => selectedOption?","created_at":"2018-06-20T03:35:23Z","updated_at":"2018-06-20T03:35:23Z","html_url":"https://github.com/zendesk/notification_app/pull/52#discussion_r196639657","pull_request_url":"https://api.github.com/repos/zendesk/notification_app/pulls/52","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/zendesk/notification_app/pulls/comments/196639657"},"html":{"href":"https://github.com/zendesk/notification_app/pull/52#discussion_r196639657"},"pull_request":{"href":"https://api.github.com/repos/zendesk/notification_app/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/zendesk/notification_app/pulls/52","id":181069603,"node_id":"MDExOlB1bGxSZXF1ZXN0MTgxMDY5NjAz","html_url":"https://github.com/zendesk/notification_app/pull/52","diff_url":"https://github.com/zendesk/notification_app/pull/52.diff","patch_url":"https://github.com/zendesk/notification_app/pull/52.patch","issue_url":"https://api.github.com/repos/zendesk/notification_app/issues/52","number":52,"state":"open","locked":false,"title":"[OFFAPPS-872] V2","user":{"login":"ocke","id":5171412,"node_id":"MDQ6VXNlcjUxNzE0MTI=","avatar_url":"https://avatars2.githubusercontent.com/u/5171412?v=4","gravatar_id":"","url":"https://api.github.com/users/ocke","html_url":"https://github.com/ocke","followers_url":"https://api.github.com/users/ocke/followers","following_url":"https://api.github.com/users/ocke/following{/other_user}","gists_url":"https://api.github.com/users/ocke/gists{/gist_id}","starred_url":"https://api.github.com/users/ocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocke/subscriptions","organizations_url":"https://api.github.com/users/ocke/orgs","repos_url":"https://api.github.com/users/ocke/repos","events_url":"https://api.github.com/users/ocke/events{/privacy}","received_events_url":"https://api.github.com/users/ocke/received_events","type":"User","site_admin":false},"body":"/cc @zendesk/vegemite \r\n\r\nConvert to V2\r\n\r\nLooks and works better!\r\n\r\nJira: https://zendesk.atlassian.net/browse/OFFAPPS-872","created_at":"2018-04-12T01:41:13Z","updated_at":"2018-06-20T03:35:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"582ea0b5e49b8170898879b7157ca57c0dfb22bf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zendesk/notification_app/pulls/52/commits","review_comments_url":"https://api.github.com/repos/zendesk/notification_app/pulls/52/comments","review_comment_url":"https://api.github.com/repos/zendesk/notification_app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendesk/notification_app/issues/52/comments","statuses_url":"https://api.github.com/repos/zendesk/notification_app/statuses/bef2ac1167cd4b76db88f66debaa38a11eedf903","head":{"label":"zendesk:olaf/v2","ref":"olaf/v2","sha":"bef2ac1167cd4b76db88f66debaa38a11eedf903","user":{"login":"zendesk","id":11525,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTI1","avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":14154698,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE1NDY5OA==","name":"notification_app","full_name":"zendesk/notification_app","owner":{"login":"zendesk","id":11525,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTI1","avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/notification_app","description":"An App for agents to be notified by their Admins","fork":false,"url":"https://api.github.com/repos/zendesk/notification_app","forks_url":"https://api.github.com/repos/zendesk/notification_app/forks","keys_url":"https://api.github.com/repos/zendesk/notification_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/notification_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/notification_app/teams","hooks_url":"https://api.github.com/repos/zendesk/notification_app/hooks","issue_events_url":"https://api.github.com/repos/zendesk/notification_app/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/notification_app/events","assignees_url":"https://api.github.com/repos/zendesk/notification_app/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/notification_app/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/notification_app/tags","blobs_url":"https://api.github.com/repos/zendesk/notification_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/notification_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/notification_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/notification_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/notification_app/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/notification_app/languages","stargazers_url":"https://api.github.com/repos/zendesk/notification_app/stargazers","contributors_url":"https://api.github.com/repos/zendesk/notification_app/contributors","subscribers_url":"https://api.github.com/repos/zendesk/notification_app/subscribers","subscription_url":"https://api.github.com/repos/zendesk/notification_app/subscription","commits_url":"https://api.github.com/repos/zendesk/notification_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/notification_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/notification_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/notification_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/notification_app/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/notification_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/notification_app/merges","archive_url":"https://api.github.com/repos/zendesk/notification_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/notification_app/downloads","issues_url":"https://api.github.com/repos/zendesk/notification_app/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/notification_app/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/notification_app/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/notification_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/notification_app/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/notification_app/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/notification_app/deployments","created_at":"2013-11-05T21:30:04Z","updated_at":"2016-10-27T21:51:57Z","pushed_at":"2018-06-19T07:27:12Z","git_url":"git://github.com/zendesk/notification_app.git","ssh_url":"git@github.com:zendesk/notification_app.git","clone_url":"https://github.com/zendesk/notification_app.git","svn_url":"https://github.com/zendesk/notification_app","homepage":null,"size":931,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"zendesk:master","ref":"master","sha":"2b9d5b656435360512333941d9532bf55a80e84b","user":{"login":"zendesk","id":11525,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTI1","avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":14154698,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE1NDY5OA==","name":"notification_app","full_name":"zendesk/notification_app","owner":{"login":"zendesk","id":11525,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTI1","avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/notification_app","description":"An App for agents to be notified by their Admins","fork":false,"url":"https://api.github.com/repos/zendesk/notification_app","forks_url":"https://api.github.com/repos/zendesk/notification_app/forks","keys_url":"https://api.github.com/repos/zendesk/notification_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/notification_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/notification_app/teams","hooks_url":"https://api.github.com/repos/zendesk/notification_app/hooks","issue_events_url":"https://api.github.com/repos/zendesk/notification_app/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/notification_app/events","assignees_url":"https://api.github.com/repos/zendesk/notification_app/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/notification_app/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/notification_app/tags","blobs_url":"https://api.github.com/repos/zendesk/notification_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/notification_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/notification_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/notification_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/notification_app/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/notification_app/languages","stargazers_url":"https://api.github.com/repos/zendesk/notification_app/stargazers","contributors_url":"https://api.github.com/repos/zendesk/notification_app/contributors","subscribers_url":"https://api.github.com/repos/zendesk/notification_app/subscribers","subscription_url":"https://api.github.com/repos/zendesk/notification_app/subscription","commits_url":"https://api.github.com/repos/zendesk/notification_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/notification_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/notification_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/notification_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/notification_app/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/notification_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/notification_app/merges","archive_url":"https://api.github.com/repos/zendesk/notification_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/notification_app/downloads","issues_url":"https://api.github.com/repos/zendesk/notification_app/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/notification_app/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/notification_app/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/notification_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/notification_app/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/notification_app/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/notification_app/deployments","created_at":"2013-11-05T21:30:04Z","updated_at":"2016-10-27T21:51:57Z","pushed_at":"2018-06-19T07:27:12Z","git_url":"git://github.com/zendesk/notification_app.git","ssh_url":"git@github.com:zendesk/notification_app.git","clone_url":"https://github.com/zendesk/notification_app.git","svn_url":"https://github.com/zendesk/notification_app","homepage":null,"size":931,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendesk/notification_app/pulls/52"},"html":{"href":"https://github.com/zendesk/notification_app/pull/52"},"issue":{"href":"https://api.github.com/repos/zendesk/notification_app/issues/52"},"comments":{"href":"https://api.github.com/repos/zendesk/notification_app/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/zendesk/notification_app/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/zendesk/notification_app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendesk/notification_app/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/zendesk/notification_app/statuses/bef2ac1167cd4b76db88f66debaa38a11eedf903"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"vaevictis"}}