{"action":"created","comment":{"url":"https://api.github.com/repos/iwa77/chat-space/pulls/comments/118173070","pull_request_review_id":39937767,"id":118173070,"diff_hunk":"@@ -3,35 +3,67 @@ $(function() {\n \n     var insertImage = '';\n     if (message.image.url) {\n-      insertImage = `<img src=\"${message.image.url}\">`;\n+      insertImage = `<div class=\"chat-main__content__image\"><img src=\"${message.image}\"></div>`;\n     }\n-    \n-    var html = {};\n-    html.name = $('<li class=\"chat-main__content__name\">').append(message.name);\n-    html.date = $('<li class=\"chat-main__content__create-time\">').append(message.created_at);\n-    html.body = $('<li class=\"chat-main__content__body\">').append(message.body)\n-    ${insertImage}\n-    return html;\n+\n+    var html = `\n+    <div class=\"message\" data-id=${message.id}>\n+      <div class=\"chat-main__content__name\">${message.name}</div>\n+      <div class=\"chat-main__content__create-time\">${message.date}</div>\n+      <div class=\"chat-main__content__message\">${message.body}</div>\n+      ${insertImage}\n+    </div>`\n+    return html\n+  };\n+\n+  function autoreload() {\n+    var lastid = $('.message').last().data('id');\n+    $.ajax({\n+      type: 'GET',\n+      url: './messages', \n+      dataType: 'json',\n+      data: {lastId: lastid}\n+    })\n+    .done(function(data) {\n+      var appendHTML = '';\n+      $.each(data.messages, function(index, message) {\n+        console.log(data);","path":"app/assets/javascripts/message.js","position":36,"original_position":36,"commit_id":"da5c0efbe5a6512519f372c8f1c9c89d5bd16b34","original_commit_id":"da5c0efbe5a6512519f372c8f1c9c89d5bd16b34","user":{"login":"tenshotanaka","id":23258763,"avatar_url":"https://avatars1.githubusercontent.com/u/23258763?v=3","gravatar_id":"","url":"https://api.github.com/users/tenshotanaka","html_url":"https://github.com/tenshotanaka","followers_url":"https://api.github.com/users/tenshotanaka/followers","following_url":"https://api.github.com/users/tenshotanaka/following{/other_user}","gists_url":"https://api.github.com/users/tenshotanaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tenshotanaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tenshotanaka/subscriptions","organizations_url":"https://api.github.com/users/tenshotanaka/orgs","repos_url":"https://api.github.com/users/tenshotanaka/repos","events_url":"https://api.github.com/users/tenshotanaka/events{/privacy}","received_events_url":"https://api.github.com/users/tenshotanaka/received_events","type":"User","site_admin":false},"body":"こちら消しましょう","created_at":"2017-05-24T06:41:10Z","updated_at":"2017-05-24T06:41:10Z","html_url":"https://github.com/iwa77/chat-space/pull/20#discussion_r118173070","pull_request_url":"https://api.github.com/repos/iwa77/chat-space/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/iwa77/chat-space/pulls/comments/118173070"},"html":{"href":"https://github.com/iwa77/chat-space/pull/20#discussion_r118173070"},"pull_request":{"href":"https://api.github.com/repos/iwa77/chat-space/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/iwa77/chat-space/pulls/20","id":121705237,"html_url":"https://github.com/iwa77/chat-space/pull/20","diff_url":"https://github.com/iwa77/chat-space/pull/20.diff","patch_url":"https://github.com/iwa77/chat-space/pull/20.patch","issue_url":"https://api.github.com/repos/iwa77/chat-space/issues/20","number":20,"state":"open","locked":false,"title":"チャット自動更新機能実装","user":{"login":"iwa77","id":27888253,"avatar_url":"https://avatars0.githubusercontent.com/u/27888253?v=3","gravatar_id":"","url":"https://api.github.com/users/iwa77","html_url":"https://github.com/iwa77","followers_url":"https://api.github.com/users/iwa77/followers","following_url":"https://api.github.com/users/iwa77/following{/other_user}","gists_url":"https://api.github.com/users/iwa77/gists{/gist_id}","starred_url":"https://api.github.com/users/iwa77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwa77/subscriptions","organizations_url":"https://api.github.com/users/iwa77/orgs","repos_url":"https://api.github.com/users/iwa77/repos","events_url":"https://api.github.com/users/iwa77/events{/privacy}","received_events_url":"https://api.github.com/users/iwa77/received_events","type":"User","site_admin":false},"body":"# [what]チャット自動更新機能実装\r\n# [why]ユーザーエクスペリエンスの向上のため","created_at":"2017-05-22T06:22:41Z","updated_at":"2017-05-24T06:41:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15866ff6cf1f84df667a0628f2f0ed4cd28c8527","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/iwa77/chat-space/pulls/20/commits","review_comments_url":"https://api.github.com/repos/iwa77/chat-space/pulls/20/comments","review_comment_url":"https://api.github.com/repos/iwa77/chat-space/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iwa77/chat-space/issues/20/comments","statuses_url":"https://api.github.com/repos/iwa77/chat-space/statuses/da5c0efbe5a6512519f372c8f1c9c89d5bd16b34","head":{"label":"iwa77:automatic-update","ref":"automatic-update","sha":"da5c0efbe5a6512519f372c8f1c9c89d5bd16b34","user":{"login":"iwa77","id":27888253,"avatar_url":"https://avatars0.githubusercontent.com/u/27888253?v=3","gravatar_id":"","url":"https://api.github.com/users/iwa77","html_url":"https://github.com/iwa77","followers_url":"https://api.github.com/users/iwa77/followers","following_url":"https://api.github.com/users/iwa77/following{/other_user}","gists_url":"https://api.github.com/users/iwa77/gists{/gist_id}","starred_url":"https://api.github.com/users/iwa77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwa77/subscriptions","organizations_url":"https://api.github.com/users/iwa77/orgs","repos_url":"https://api.github.com/users/iwa77/repos","events_url":"https://api.github.com/users/iwa77/events{/privacy}","received_events_url":"https://api.github.com/users/iwa77/received_events","type":"User","site_admin":false},"repo":{"id":89468782,"name":"chat-space","full_name":"iwa77/chat-space","owner":{"login":"iwa77","id":27888253,"avatar_url":"https://avatars0.githubusercontent.com/u/27888253?v=3","gravatar_id":"","url":"https://api.github.com/users/iwa77","html_url":"https://github.com/iwa77","followers_url":"https://api.github.com/users/iwa77/followers","following_url":"https://api.github.com/users/iwa77/following{/other_user}","gists_url":"https://api.github.com/users/iwa77/gists{/gist_id}","starred_url":"https://api.github.com/users/iwa77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwa77/subscriptions","organizations_url":"https://api.github.com/users/iwa77/orgs","repos_url":"https://api.github.com/users/iwa77/repos","events_url":"https://api.github.com/users/iwa77/events{/privacy}","received_events_url":"https://api.github.com/users/iwa77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iwa77/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/iwa77/chat-space","forks_url":"https://api.github.com/repos/iwa77/chat-space/forks","keys_url":"https://api.github.com/repos/iwa77/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iwa77/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iwa77/chat-space/teams","hooks_url":"https://api.github.com/repos/iwa77/chat-space/hooks","issue_events_url":"https://api.github.com/repos/iwa77/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/iwa77/chat-space/events","assignees_url":"https://api.github.com/repos/iwa77/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/iwa77/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/iwa77/chat-space/tags","blobs_url":"https://api.github.com/repos/iwa77/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iwa77/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iwa77/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/iwa77/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iwa77/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/iwa77/chat-space/languages","stargazers_url":"https://api.github.com/repos/iwa77/chat-space/stargazers","contributors_url":"https://api.github.com/repos/iwa77/chat-space/contributors","subscribers_url":"https://api.github.com/repos/iwa77/chat-space/subscribers","subscription_url":"https://api.github.com/repos/iwa77/chat-space/subscription","commits_url":"https://api.github.com/repos/iwa77/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/iwa77/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/iwa77/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/iwa77/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/iwa77/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/iwa77/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iwa77/chat-space/merges","archive_url":"https://api.github.com/repos/iwa77/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iwa77/chat-space/downloads","issues_url":"https://api.github.com/repos/iwa77/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/iwa77/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/iwa77/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/iwa77/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iwa77/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/iwa77/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/iwa77/chat-space/deployments","created_at":"2017-04-26T10:30:34Z","updated_at":"2017-04-26T10:44:36Z","pushed_at":"2017-05-24T06:38:46Z","git_url":"git://github.com/iwa77/chat-space.git","ssh_url":"git@github.com:iwa77/chat-space.git","clone_url":"https://github.com/iwa77/chat-space.git","svn_url":"https://github.com/iwa77/chat-space","homepage":null,"size":169,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"iwa77:master","ref":"master","sha":"10b1aedc567d929e879ce497a53df2da56721a71","user":{"login":"iwa77","id":27888253,"avatar_url":"https://avatars0.githubusercontent.com/u/27888253?v=3","gravatar_id":"","url":"https://api.github.com/users/iwa77","html_url":"https://github.com/iwa77","followers_url":"https://api.github.com/users/iwa77/followers","following_url":"https://api.github.com/users/iwa77/following{/other_user}","gists_url":"https://api.github.com/users/iwa77/gists{/gist_id}","starred_url":"https://api.github.com/users/iwa77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwa77/subscriptions","organizations_url":"https://api.github.com/users/iwa77/orgs","repos_url":"https://api.github.com/users/iwa77/repos","events_url":"https://api.github.com/users/iwa77/events{/privacy}","received_events_url":"https://api.github.com/users/iwa77/received_events","type":"User","site_admin":false},"repo":{"id":89468782,"name":"chat-space","full_name":"iwa77/chat-space","owner":{"login":"iwa77","id":27888253,"avatar_url":"https://avatars0.githubusercontent.com/u/27888253?v=3","gravatar_id":"","url":"https://api.github.com/users/iwa77","html_url":"https://github.com/iwa77","followers_url":"https://api.github.com/users/iwa77/followers","following_url":"https://api.github.com/users/iwa77/following{/other_user}","gists_url":"https://api.github.com/users/iwa77/gists{/gist_id}","starred_url":"https://api.github.com/users/iwa77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwa77/subscriptions","organizations_url":"https://api.github.com/users/iwa77/orgs","repos_url":"https://api.github.com/users/iwa77/repos","events_url":"https://api.github.com/users/iwa77/events{/privacy}","received_events_url":"https://api.github.com/users/iwa77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iwa77/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/iwa77/chat-space","forks_url":"https://api.github.com/repos/iwa77/chat-space/forks","keys_url":"https://api.github.com/repos/iwa77/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iwa77/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iwa77/chat-space/teams","hooks_url":"https://api.github.com/repos/iwa77/chat-space/hooks","issue_events_url":"https://api.github.com/repos/iwa77/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/iwa77/chat-space/events","assignees_url":"https://api.github.com/repos/iwa77/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/iwa77/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/iwa77/chat-space/tags","blobs_url":"https://api.github.com/repos/iwa77/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iwa77/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iwa77/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/iwa77/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iwa77/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/iwa77/chat-space/languages","stargazers_url":"https://api.github.com/repos/iwa77/chat-space/stargazers","contributors_url":"https://api.github.com/repos/iwa77/chat-space/contributors","subscribers_url":"https://api.github.com/repos/iwa77/chat-space/subscribers","subscription_url":"https://api.github.com/repos/iwa77/chat-space/subscription","commits_url":"https://api.github.com/repos/iwa77/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/iwa77/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/iwa77/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/iwa77/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/iwa77/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/iwa77/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iwa77/chat-space/merges","archive_url":"https://api.github.com/repos/iwa77/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iwa77/chat-space/downloads","issues_url":"https://api.github.com/repos/iwa77/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/iwa77/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/iwa77/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/iwa77/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iwa77/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/iwa77/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/iwa77/chat-space/deployments","created_at":"2017-04-26T10:30:34Z","updated_at":"2017-04-26T10:44:36Z","pushed_at":"2017-05-24T06:38:46Z","git_url":"git://github.com/iwa77/chat-space.git","ssh_url":"git@github.com:iwa77/chat-space.git","clone_url":"https://github.com/iwa77/chat-space.git","svn_url":"https://github.com/iwa77/chat-space","homepage":null,"size":169,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iwa77/chat-space/pulls/20"},"html":{"href":"https://github.com/iwa77/chat-space/pull/20"},"issue":{"href":"https://api.github.com/repos/iwa77/chat-space/issues/20"},"comments":{"href":"https://api.github.com/repos/iwa77/chat-space/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/iwa77/chat-space/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/iwa77/chat-space/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iwa77/chat-space/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/iwa77/chat-space/statuses/da5c0efbe5a6512519f372c8f1c9c89d5bd16b34"}}}}
{"actor":{"display_login":"tenshotanaka"}}