payload: {"action":"created","comment":{"url":"https://api.github.com/repos/Flowertone2/chat-space/pulls/comments/323208156","pull_request_review_id":286747351,"id":323208156,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyMzIwODE1Ng==","diff_hunk":"@@ -0,0 +1,75 @@\n+$(function(){\n+  function buildHTML(user){\n+  var html = `<div class=\"chat-group-user clearfix\">\n+                <p class=\"chat-group-user__name\"> ${user.user_name} </p>\n+                <div class=\"user-search-add chat-group-user__btn chat-group-user__btn--add\" data-user-id=${user.id} data-user-name=${user.user_name}>追加</div>\n+              </div>`\n+    $('#user-search-result').append(html);\n+  }\n+\n+    // function appendErrMsgToHTML(msg){\n+    //   var html = `\n+    //     <div class=\"chat-group-user clearfix\">\n+    //       <p class=\"chat-group-user__name\">${msg}</p>\n+    //     </div>`;\n+    //     $('#user-search-result').append(html);\n+    // }\n+\n+  function destroyHTML(user_name, user_id){\n+  var html = `<div class=\"chat-group-user\">\n+                    <input name=\"group[user_ids][]\" type=\"hidden\" value=${user_id}>\n+                    <p class=\"chat-group-user__name\"> ${user_name}</p>\n+                    <div class=\"user-search-remove chat-group-user__btn chat-group-user__btn--remove js-remove-btn\">削除</div>\n+              </div>`\n+    $('#chat-group-user').append(html);\n+  }\n+\n+      \n+  $(function(){\n+    $('#chat-group-form__input').on('keyup', function(){\n+      var input = $(\"#chat-group-form__input\").val();\n+      $.ajax({\n+        url: '/users',\n+        type: \"GET\",\n+        data: { keyword: input },\n+        dataType: 'json'\n+      })\n+      .done(function(users) {\n+        $(\"#user-search-result\").empty();\n+        if (users.length !== 0) {\n+          users.forEach(function(user){\n+          buildHTML(user);\n+          });\n+        }\n+        // else{\n+        //   appendErrMsgToHTML('messageなし');\n+        // }\n+      });\n+    });\n+      $(function(){\n+        $(document).on('click', '.user-search-add', function() {\n+          var user_name = $(this).data(\"user-name\");\n+          var user_id = $(this).data(\"user-id\");\n+          $(this).parent().remove();\n+          destroyHTML(user_name, user_id);\n+        });\n+          $(function(){\n+            $(document).on('click', '.user-search-remove', function() {\n+              var user_name = $(this).data(\"user-name\");\n+              var user_id = $(this).data(\"user-id\");\n+              $(this).parent().remove();\n+              buildHTML(user_name, user_id);\n+            });\n+    // $(function(){\n+    //   $(\"chat-group-user__btn\").on(\"click\", function (user_name) {\n+    //     console.log(user_name)\n+    //     if (users.length !== 0) {\n+    //       users.forEach(function(user_name){\n+    //         $('#user-search-result').append(html);\n+    //       });\n+    //     }\n+    //   })","path":"app/assets/javascripts/user.js","position":71,"original_position":71,"commit_id":"ba31f6ffc6f900a3377d1e1fa782f5883c9bbbb9","original_commit_id":"ba31f6ffc6f900a3377d1e1fa782f5883c9bbbb9","user":{"login":"shingoteshima","id":27781505,"node_id":"MDQ6VXNlcjI3NzgxNTA1","avatar_url":"https://avatars0.githubusercontent.com/u/27781505?v=4","gravatar_id":"","url":"https://api.github.com/users/shingoteshima","html_url":"https://github.com/shingoteshima","followers_url":"https://api.github.com/users/shingoteshima/followers","following_url":"https://api.github.com/users/shingoteshima/following{/other_user}","gists_url":"https://api.github.com/users/shingoteshima/gists{/gist_id}","starred_url":"https://api.github.com/users/shingoteshima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shingoteshima/subscriptions","organizations_url":"https://api.github.com/users/shingoteshima/orgs","repos_url":"https://api.github.com/users/shingoteshima/repos","events_url":"https://api.github.com/users/shingoteshima/events{/privacy}","received_events_url":"https://api.github.com/users/shingoteshima/received_events","type":"User","site_admin":false},"body":"こちらも。","created_at":"2019-09-11T12:18:59Z","updated_at":"2019-09-11T12:19:39Z","html_url":"https://github.com/Flowertone2/chat-space/pull/4#discussion_r323208156","pull_request_url":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Flowertone2/chat-space/pulls/comments/323208156"},"html":{"href":"https://github.com/Flowertone2/chat-space/pull/4#discussion_r323208156"},"pull_request":{"href":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4","id":316418427,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE2NDE4NDI3","html_url":"https://github.com/Flowertone2/chat-space/pull/4","diff_url":"https://github.com/Flowertone2/chat-space/pull/4.diff","patch_url":"https://github.com/Flowertone2/chat-space/pull/4.patch","issue_url":"https://api.github.com/repos/Flowertone2/chat-space/issues/4","number":4,"state":"open","locked":false,"title":"インクリメンタルサーチ","user":{"login":"Flowertone2","id":54387825,"node_id":"MDQ6VXNlcjU0Mzg3ODI1","avatar_url":"https://avatars0.githubusercontent.com/u/54387825?v=4","gravatar_id":"","url":"https://api.github.com/users/Flowertone2","html_url":"https://github.com/Flowertone2","followers_url":"https://api.github.com/users/Flowertone2/followers","following_url":"https://api.github.com/users/Flowertone2/following{/other_user}","gists_url":"https://api.github.com/users/Flowertone2/gists{/gist_id}","starred_url":"https://api.github.com/users/Flowertone2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flowertone2/subscriptions","organizations_url":"https://api.github.com/users/Flowertone2/orgs","repos_url":"https://api.github.com/users/Flowertone2/repos","events_url":"https://api.github.com/users/Flowertone2/events{/privacy}","received_events_url":"https://api.github.com/users/Flowertone2/received_events","type":"User","site_admin":false},"body":"# WHAT \r\nインクリメンタルサーチの実装\r\n# WHY\r\nユーザーの利便性向上のため\r\n","created_at":"2019-09-11T12:15:51Z","updated_at":"2019-09-11T12:19:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cfd4f2938048fe9f4f42f7e1b890bdd177ff8602","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4/commits","review_comments_url":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4/comments","review_comment_url":"https://api.github.com/repos/Flowertone2/chat-space/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Flowertone2/chat-space/issues/4/comments","statuses_url":"https://api.github.com/repos/Flowertone2/chat-space/statuses/ba31f6ffc6f900a3377d1e1fa782f5883c9bbbb9","head":{"label":"Flowertone2:incremental_search","ref":"incremental_search","sha":"ba31f6ffc6f900a3377d1e1fa782f5883c9bbbb9","user":{"login":"Flowertone2","id":54387825,"node_id":"MDQ6VXNlcjU0Mzg3ODI1","avatar_url":"https://avatars0.githubusercontent.com/u/54387825?v=4","gravatar_id":"","url":"https://api.github.com/users/Flowertone2","html_url":"https://github.com/Flowertone2","followers_url":"https://api.github.com/users/Flowertone2/followers","following_url":"https://api.github.com/users/Flowertone2/following{/other_user}","gists_url":"https://api.github.com/users/Flowertone2/gists{/gist_id}","starred_url":"https://api.github.com/users/Flowertone2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flowertone2/subscriptions","organizations_url":"https://api.github.com/users/Flowertone2/orgs","repos_url":"https://api.github.com/users/Flowertone2/repos","events_url":"https://api.github.com/users/Flowertone2/events{/privacy}","received_events_url":"https://api.github.com/users/Flowertone2/received_events","type":"User","site_admin":false},"repo":{"id":203769740,"node_id":"MDEwOlJlcG9zaXRvcnkyMDM3Njk3NDA=","name":"chat-space","full_name":"Flowertone2/chat-space","private":false,"owner":{"login":"Flowertone2","id":54387825,"node_id":"MDQ6VXNlcjU0Mzg3ODI1","avatar_url":"https://avatars0.githubusercontent.com/u/54387825?v=4","gravatar_id":"","url":"https://api.github.com/users/Flowertone2","html_url":"https://github.com/Flowertone2","followers_url":"https://api.github.com/users/Flowertone2/followers","following_url":"https://api.github.com/users/Flowertone2/following{/other_user}","gists_url":"https://api.github.com/users/Flowertone2/gists{/gist_id}","starred_url":"https://api.github.com/users/Flowertone2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flowertone2/subscriptions","organizations_url":"https://api.github.com/users/Flowertone2/orgs","repos_url":"https://api.github.com/users/Flowertone2/repos","events_url":"https://api.github.com/users/Flowertone2/events{/privacy}","received_events_url":"https://api.github.com/users/Flowertone2/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Flowertone2/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/Flowertone2/chat-space","forks_url":"https://api.github.com/repos/Flowertone2/chat-space/forks","keys_url":"https://api.github.com/repos/Flowertone2/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Flowertone2/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Flowertone2/chat-space/teams","hooks_url":"https://api.github.com/repos/Flowertone2/chat-space/hooks","issue_events_url":"https://api.github.com/repos/Flowertone2/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/Flowertone2/chat-space/events","assignees_url":"https://api.github.com/repos/Flowertone2/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/Flowertone2/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/Flowertone2/chat-space/tags","blobs_url":"https://api.github.com/repos/Flowertone2/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Flowertone2/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Flowertone2/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/Flowertone2/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Flowertone2/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/Flowertone2/chat-space/languages","stargazers_url":"https://api.github.com/repos/Flowertone2/chat-space/stargazers","contributors_url":"https://api.github.com/repos/Flowertone2/chat-space/contributors","subscribers_url":"https://api.github.com/repos/Flowertone2/chat-space/subscribers","subscription_url":"https://api.github.com/repos/Flowertone2/chat-space/subscription","commits_url":"https://api.github.com/repos/Flowertone2/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/Flowertone2/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/Flowertone2/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/Flowertone2/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/Flowertone2/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/Flowertone2/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Flowertone2/chat-space/merges","archive_url":"https://api.github.com/repos/Flowertone2/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Flowertone2/chat-space/downloads","issues_url":"https://api.github.com/repos/Flowertone2/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/Flowertone2/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/Flowertone2/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/Flowertone2/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Flowertone2/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/Flowertone2/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/Flowertone2/chat-space/deployments","created_at":"2019-08-22T10:19:04Z","updated_at":"2019-09-07T09:11:00Z","pushed_at":"2019-09-11T12:15:52Z","git_url":"git://github.com/Flowertone2/chat-space.git","ssh_url":"git@github.com:Flowertone2/chat-space.git","clone_url":"https://github.com/Flowertone2/chat-space.git","svn_url":"https://github.com/Flowertone2/chat-space","homepage":null,"size":63,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Flowertone2:master","ref":"master","sha":"8874b1fb20b632a7cc27eb4aa83a89c657e426a4","user":{"login":"Flowertone2","id":54387825,"node_id":"MDQ6VXNlcjU0Mzg3ODI1","avatar_url":"https://avatars0.githubusercontent.com/u/54387825?v=4","gravatar_id":"","url":"https://api.github.com/users/Flowertone2","html_url":"https://github.com/Flowertone2","followers_url":"https://api.github.com/users/Flowertone2/followers","following_url":"https://api.github.com/users/Flowertone2/following{/other_user}","gists_url":"https://api.github.com/users/Flowertone2/gists{/gist_id}","starred_url":"https://api.github.com/users/Flowertone2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flowertone2/subscriptions","organizations_url":"https://api.github.com/users/Flowertone2/orgs","repos_url":"https://api.github.com/users/Flowertone2/repos","events_url":"https://api.github.com/users/Flowertone2/events{/privacy}","received_events_url":"https://api.github.com/users/Flowertone2/received_events","type":"User","site_admin":false},"repo":{"id":203769740,"node_id":"MDEwOlJlcG9zaXRvcnkyMDM3Njk3NDA=","name":"chat-space","full_name":"Flowertone2/chat-space","private":false,"owner":{"login":"Flowertone2","id":54387825,"node_id":"MDQ6VXNlcjU0Mzg3ODI1","avatar_url":"https://avatars0.githubusercontent.com/u/54387825?v=4","gravatar_id":"","url":"https://api.github.com/users/Flowertone2","html_url":"https://github.com/Flowertone2","followers_url":"https://api.github.com/users/Flowertone2/followers","following_url":"https://api.github.com/users/Flowertone2/following{/other_user}","gists_url":"https://api.github.com/users/Flowertone2/gists{/gist_id}","starred_url":"https://api.github.com/users/Flowertone2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flowertone2/subscriptions","organizations_url":"https://api.github.com/users/Flowertone2/orgs","repos_url":"https://api.github.com/users/Flowertone2/repos","events_url":"https://api.github.com/users/Flowertone2/events{/privacy}","received_events_url":"https://api.github.com/users/Flowertone2/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Flowertone2/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/Flowertone2/chat-space","forks_url":"https://api.github.com/repos/Flowertone2/chat-space/forks","keys_url":"https://api.github.com/repos/Flowertone2/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Flowertone2/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Flowertone2/chat-space/teams","hooks_url":"https://api.github.com/repos/Flowertone2/chat-space/hooks","issue_events_url":"https://api.github.com/repos/Flowertone2/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/Flowertone2/chat-space/events","assignees_url":"https://api.github.com/repos/Flowertone2/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/Flowertone2/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/Flowertone2/chat-space/tags","blobs_url":"https://api.github.com/repos/Flowertone2/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Flowertone2/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Flowertone2/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/Flowertone2/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Flowertone2/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/Flowertone2/chat-space/languages","stargazers_url":"https://api.github.com/repos/Flowertone2/chat-space/stargazers","contributors_url":"https://api.github.com/repos/Flowertone2/chat-space/contributors","subscribers_url":"https://api.github.com/repos/Flowertone2/chat-space/subscribers","subscription_url":"https://api.github.com/repos/Flowertone2/chat-space/subscription","commits_url":"https://api.github.com/repos/Flowertone2/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/Flowertone2/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/Flowertone2/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/Flowertone2/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/Flowertone2/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/Flowertone2/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Flowertone2/chat-space/merges","archive_url":"https://api.github.com/repos/Flowertone2/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Flowertone2/chat-space/downloads","issues_url":"https://api.github.com/repos/Flowertone2/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/Flowertone2/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/Flowertone2/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/Flowertone2/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Flowertone2/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/Flowertone2/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/Flowertone2/chat-space/deployments","created_at":"2019-08-22T10:19:04Z","updated_at":"2019-09-07T09:11:00Z","pushed_at":"2019-09-11T12:15:52Z","git_url":"git://github.com/Flowertone2/chat-space.git","ssh_url":"git@github.com:Flowertone2/chat-space.git","clone_url":"https://github.com/Flowertone2/chat-space.git","svn_url":"https://github.com/Flowertone2/chat-space","homepage":null,"size":63,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4"},"html":{"href":"https://github.com/Flowertone2/chat-space/pull/4"},"issue":{"href":"https://api.github.com/repos/Flowertone2/chat-space/issues/4"},"comments":{"href":"https://api.github.com/repos/Flowertone2/chat-space/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/Flowertone2/chat-space/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Flowertone2/chat-space/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/Flowertone2/chat-space/statuses/ba31f6ffc6f900a3377d1e1fa782f5883c9bbbb9"}},"author_association":"OWNER"}}
other: {"actor":{"display_login":"shingoteshima"}}