{"action":"created","comment":{"url":"https://api.github.com/repos/st-yk/chat-space/pulls/comments/356970335","pull_request_review_id":331007511,"id":356970335,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1Njk3MDMzNQ==","diff_hunk":"@@ -1,43 +1,63 @@\n $(function(){\n-  function buildHTML(message){// 「もしメッセージに画像が含まれていたら」という条件式\n-    if (message.image) {\n-      var html = \n-      `<div class=\"chat-main__message-list\">\n-        <div class=\"chat-main__message-name\">\n-          ${message.user_name}\n-        </div>\n-      <div class=\"chat-main__message-name__data\">\n-          ${message.date}\n-      </div>\n-      <div class=\"chat-main__message-comment\"></div>\n-        <p class=\"chat-main__message-comment\">\n-          ${message.text}\n-        </p>\n-        <img src=\"${message.image}\">\n-      </div>`\n-    } \n-    else {\n-      var html = //メッセージに画像が含まれない場合のHTMLを作る\n-      `<div class=\"chat-main__message-list\">\n-        <div class=\"chat-main__message-name\">\n-          ${message.user_name}\n-        </div>\n-          <div class=\"chat-main__message-name__data\">\n-            ${message.date}\n-          </div>\n-        <div class=\"chat-main__message-comment\"></div>\n-          <p class=\"chat-main__message-comment\">\n-            ${message.text}\n-          </p>\n-        </div>`\n-    }\n-    return html\n-  }\n+  // console.log(last_message_id);\n+  var buildHTML = function(message) {\n+    if (message.text && message.image) {\n+      //data-idが反映されるようにしている\n+      var html = `<div class=\"message\" data-id=` + message.id + `>` +\n+        `<div class=\"upper-message\">` +\n+          `<div class=\"upper-message__user-name\">` +\n+            message.user_name +\n+          `</div>` +\n+          `<div class=\"upper-message__date\">` +\n+            message.date  +\n+          `</div>` +\n+        `</div>` +\n+        `<div class=\"lower-message\">` +\n+          `<p class=\"lower-message__content\">` +\n+            message.text +\n+          `</p>` +\n+          `<img src=\"` + message.image + `\" class=\"lower-message__image\" >` +\n+        `</div>` +\n+      `</div>`\n+    } else if (message.text) {\n+      //同様に、data-idが反映されるようにしている\n+      var html = `<div class=\"message\" data-message-id=` + message.id + `>` +\n+        `<div class=\"upper-message\">` +\n+          `<div class=\"upper-message__user-name\">` +\n+            message.user_name +\n+          `</div>` +\n+          `<div class=\"upper-message__date\">` +\n+            message.date  +\n+          `</div>` +\n+        `</div>` +\n+        `<div class=\"lower-message\">` +\n+          `<p class=\"lower-message__content\">` +\n+            message.text +\n+          `</p>` +\n+        `</div>` +\n+      `</div>`\n+    } else if (message.image) {\n+      //同様に、data-idが反映されるようにしている\n+      var html = `<div class=\"message\" data-message-id=` + message.id + `>` +\n+        `<div class=\"upper-message\">` +\n+          `<div class=\"upper-message__user-name\">` +\n+            message.user_name +\n+          `</div>` +\n+          `<div class=\"upper-message__date\">` +\n+            message.date  +\n+          `</div>` +\n+        `</div>` +\n+        `<div class=\"lower-message\">` +\n+          `<img src=\"` + message.image + `\" class=\"lower-message__image\" >` +\n+        `</div>` +\n+      `</div>`","path":"app/assets/javascripts/message.js","position":87,"original_position":87,"commit_id":"64591a4fa82e7a62d44bf568cf4abb0fa7c85ee5","original_commit_id":"64591a4fa82e7a62d44bf568cf4abb0fa7c85ee5","user":{"login":"TOMARUMARU","id":27071603,"node_id":"MDQ6VXNlcjI3MDcxNjAz","avatar_url":"https://avatars1.githubusercontent.com/u/27071603?v=4","gravatar_id":"","url":"https://api.github.com/users/TOMARUMARU","html_url":"https://github.com/TOMARUMARU","followers_url":"https://api.github.com/users/TOMARUMARU/followers","following_url":"https://api.github.com/users/TOMARUMARU/following{/other_user}","gists_url":"https://api.github.com/users/TOMARUMARU/gists{/gist_id}","starred_url":"https://api.github.com/users/TOMARUMARU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TOMARUMARU/subscriptions","organizations_url":"https://api.github.com/users/TOMARUMARU/orgs","repos_url":"https://api.github.com/users/TOMARUMARU/repos","events_url":"https://api.github.com/users/TOMARUMARU/events{/privacy}","received_events_url":"https://api.github.com/users/TOMARUMARU/received_events","type":"User","site_admin":false},"body":"全体をバッククォートで囲えば、+でつなぐ必要はありません","created_at":"2019-12-12T06:00:48Z","updated_at":"2019-12-12T06:01:17Z","html_url":"https://github.com/st-yk/chat-space/pull/11#discussion_r356970335","pull_request_url":"https://api.github.com/repos/st-yk/chat-space/pulls/11","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/st-yk/chat-space/pulls/comments/356970335"},"html":{"href":"https://github.com/st-yk/chat-space/pull/11#discussion_r356970335"},"pull_request":{"href":"https://api.github.com/repos/st-yk/chat-space/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/st-yk/chat-space/pulls/11","id":352245423,"node_id":"MDExOlB1bGxSZXF1ZXN0MzUyMjQ1NDIz","html_url":"https://github.com/st-yk/chat-space/pull/11","diff_url":"https://github.com/st-yk/chat-space/pull/11.diff","patch_url":"https://github.com/st-yk/chat-space/pull/11.patch","issue_url":"https://api.github.com/repos/st-yk/chat-space/issues/11","number":11,"state":"open","locked":false,"title":"自動更新","user":{"login":"st-yk","id":58296573,"node_id":"MDQ6VXNlcjU4Mjk2NTcz","avatar_url":"https://avatars3.githubusercontent.com/u/58296573?v=4","gravatar_id":"","url":"https://api.github.com/users/st-yk","html_url":"https://github.com/st-yk","followers_url":"https://api.github.com/users/st-yk/followers","following_url":"https://api.github.com/users/st-yk/following{/other_user}","gists_url":"https://api.github.com/users/st-yk/gists{/gist_id}","starred_url":"https://api.github.com/users/st-yk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st-yk/subscriptions","organizations_url":"https://api.github.com/users/st-yk/orgs","repos_url":"https://api.github.com/users/st-yk/repos","events_url":"https://api.github.com/users/st-yk/events{/privacy}","received_events_url":"https://api.github.com/users/st-yk/received_events","type":"User","site_admin":false},"body":"### **what**\r\n自動更新機能の実装\r\n\r\n### **why**\r\nリロードする必要をなくし、\r\nアプリ利用者のコミュニケーション改善のするため","created_at":"2019-12-12T05:56:55Z","updated_at":"2019-12-12T06:01:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"341cc66cdc25cafbf332c7712463b3f81982f77f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/st-yk/chat-space/pulls/11/commits","review_comments_url":"https://api.github.com/repos/st-yk/chat-space/pulls/11/comments","review_comment_url":"https://api.github.com/repos/st-yk/chat-space/pulls/comments{/number}","comments_url":"https://api.github.com/repos/st-yk/chat-space/issues/11/comments","statuses_url":"https://api.github.com/repos/st-yk/chat-space/statuses/64591a4fa82e7a62d44bf568cf4abb0fa7c85ee5","head":{"label":"st-yk:自動更新機能","ref":"自動更新機能","sha":"64591a4fa82e7a62d44bf568cf4abb0fa7c85ee5","user":{"login":"st-yk","id":58296573,"node_id":"MDQ6VXNlcjU4Mjk2NTcz","avatar_url":"https://avatars3.githubusercontent.com/u/58296573?v=4","gravatar_id":"","url":"https://api.github.com/users/st-yk","html_url":"https://github.com/st-yk","followers_url":"https://api.github.com/users/st-yk/followers","following_url":"https://api.github.com/users/st-yk/following{/other_user}","gists_url":"https://api.github.com/users/st-yk/gists{/gist_id}","starred_url":"https://api.github.com/users/st-yk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st-yk/subscriptions","organizations_url":"https://api.github.com/users/st-yk/orgs","repos_url":"https://api.github.com/users/st-yk/repos","events_url":"https://api.github.com/users/st-yk/events{/privacy}","received_events_url":"https://api.github.com/users/st-yk/received_events","type":"User","site_admin":false},"repo":{"id":224784409,"node_id":"MDEwOlJlcG9zaXRvcnkyMjQ3ODQ0MDk=","name":"chat-space","full_name":"st-yk/chat-space","private":false,"owner":{"login":"st-yk","id":58296573,"node_id":"MDQ6VXNlcjU4Mjk2NTcz","avatar_url":"https://avatars3.githubusercontent.com/u/58296573?v=4","gravatar_id":"","url":"https://api.github.com/users/st-yk","html_url":"https://github.com/st-yk","followers_url":"https://api.github.com/users/st-yk/followers","following_url":"https://api.github.com/users/st-yk/following{/other_user}","gists_url":"https://api.github.com/users/st-yk/gists{/gist_id}","starred_url":"https://api.github.com/users/st-yk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st-yk/subscriptions","organizations_url":"https://api.github.com/users/st-yk/orgs","repos_url":"https://api.github.com/users/st-yk/repos","events_url":"https://api.github.com/users/st-yk/events{/privacy}","received_events_url":"https://api.github.com/users/st-yk/received_events","type":"User","site_admin":false},"html_url":"https://github.com/st-yk/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/st-yk/chat-space","forks_url":"https://api.github.com/repos/st-yk/chat-space/forks","keys_url":"https://api.github.com/repos/st-yk/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/st-yk/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/st-yk/chat-space/teams","hooks_url":"https://api.github.com/repos/st-yk/chat-space/hooks","issue_events_url":"https://api.github.com/repos/st-yk/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/st-yk/chat-space/events","assignees_url":"https://api.github.com/repos/st-yk/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/st-yk/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/st-yk/chat-space/tags","blobs_url":"https://api.github.com/repos/st-yk/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/st-yk/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/st-yk/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/st-yk/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/st-yk/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/st-yk/chat-space/languages","stargazers_url":"https://api.github.com/repos/st-yk/chat-space/stargazers","contributors_url":"https://api.github.com/repos/st-yk/chat-space/contributors","subscribers_url":"https://api.github.com/repos/st-yk/chat-space/subscribers","subscription_url":"https://api.github.com/repos/st-yk/chat-space/subscription","commits_url":"https://api.github.com/repos/st-yk/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/st-yk/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/st-yk/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/st-yk/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/st-yk/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/st-yk/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/st-yk/chat-space/merges","archive_url":"https://api.github.com/repos/st-yk/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/st-yk/chat-space/downloads","issues_url":"https://api.github.com/repos/st-yk/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/st-yk/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/st-yk/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/st-yk/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/st-yk/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/st-yk/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/st-yk/chat-space/deployments","created_at":"2019-11-29T05:42:47Z","updated_at":"2019-12-11T08:48:31Z","pushed_at":"2019-12-12T05:56:56Z","git_url":"git://github.com/st-yk/chat-space.git","ssh_url":"git@github.com:st-yk/chat-space.git","clone_url":"https://github.com/st-yk/chat-space.git","svn_url":"https://github.com/st-yk/chat-space","homepage":null,"size":224,"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":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"st-yk:master","ref":"master","sha":"5e445557e99f156930b51fc3e71663845dbddb55","user":{"login":"st-yk","id":58296573,"node_id":"MDQ6VXNlcjU4Mjk2NTcz","avatar_url":"https://avatars3.githubusercontent.com/u/58296573?v=4","gravatar_id":"","url":"https://api.github.com/users/st-yk","html_url":"https://github.com/st-yk","followers_url":"https://api.github.com/users/st-yk/followers","following_url":"https://api.github.com/users/st-yk/following{/other_user}","gists_url":"https://api.github.com/users/st-yk/gists{/gist_id}","starred_url":"https://api.github.com/users/st-yk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st-yk/subscriptions","organizations_url":"https://api.github.com/users/st-yk/orgs","repos_url":"https://api.github.com/users/st-yk/repos","events_url":"https://api.github.com/users/st-yk/events{/privacy}","received_events_url":"https://api.github.com/users/st-yk/received_events","type":"User","site_admin":false},"repo":{"id":224784409,"node_id":"MDEwOlJlcG9zaXRvcnkyMjQ3ODQ0MDk=","name":"chat-space","full_name":"st-yk/chat-space","private":false,"owner":{"login":"st-yk","id":58296573,"node_id":"MDQ6VXNlcjU4Mjk2NTcz","avatar_url":"https://avatars3.githubusercontent.com/u/58296573?v=4","gravatar_id":"","url":"https://api.github.com/users/st-yk","html_url":"https://github.com/st-yk","followers_url":"https://api.github.com/users/st-yk/followers","following_url":"https://api.github.com/users/st-yk/following{/other_user}","gists_url":"https://api.github.com/users/st-yk/gists{/gist_id}","starred_url":"https://api.github.com/users/st-yk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st-yk/subscriptions","organizations_url":"https://api.github.com/users/st-yk/orgs","repos_url":"https://api.github.com/users/st-yk/repos","events_url":"https://api.github.com/users/st-yk/events{/privacy}","received_events_url":"https://api.github.com/users/st-yk/received_events","type":"User","site_admin":false},"html_url":"https://github.com/st-yk/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/st-yk/chat-space","forks_url":"https://api.github.com/repos/st-yk/chat-space/forks","keys_url":"https://api.github.com/repos/st-yk/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/st-yk/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/st-yk/chat-space/teams","hooks_url":"https://api.github.com/repos/st-yk/chat-space/hooks","issue_events_url":"https://api.github.com/repos/st-yk/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/st-yk/chat-space/events","assignees_url":"https://api.github.com/repos/st-yk/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/st-yk/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/st-yk/chat-space/tags","blobs_url":"https://api.github.com/repos/st-yk/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/st-yk/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/st-yk/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/st-yk/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/st-yk/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/st-yk/chat-space/languages","stargazers_url":"https://api.github.com/repos/st-yk/chat-space/stargazers","contributors_url":"https://api.github.com/repos/st-yk/chat-space/contributors","subscribers_url":"https://api.github.com/repos/st-yk/chat-space/subscribers","subscription_url":"https://api.github.com/repos/st-yk/chat-space/subscription","commits_url":"https://api.github.com/repos/st-yk/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/st-yk/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/st-yk/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/st-yk/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/st-yk/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/st-yk/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/st-yk/chat-space/merges","archive_url":"https://api.github.com/repos/st-yk/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/st-yk/chat-space/downloads","issues_url":"https://api.github.com/repos/st-yk/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/st-yk/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/st-yk/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/st-yk/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/st-yk/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/st-yk/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/st-yk/chat-space/deployments","created_at":"2019-11-29T05:42:47Z","updated_at":"2019-12-11T08:48:31Z","pushed_at":"2019-12-12T05:56:56Z","git_url":"git://github.com/st-yk/chat-space.git","ssh_url":"git@github.com:st-yk/chat-space.git","clone_url":"https://github.com/st-yk/chat-space.git","svn_url":"https://github.com/st-yk/chat-space","homepage":null,"size":224,"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":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/st-yk/chat-space/pulls/11"},"html":{"href":"https://github.com/st-yk/chat-space/pull/11"},"issue":{"href":"https://api.github.com/repos/st-yk/chat-space/issues/11"},"comments":{"href":"https://api.github.com/repos/st-yk/chat-space/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/st-yk/chat-space/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/st-yk/chat-space/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/st-yk/chat-space/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/st-yk/chat-space/statuses/64591a4fa82e7a62d44bf568cf4abb0fa7c85ee5"}},"author_association":"OWNER"}}
{"actor":{"display_login":"TOMARUMARU"}}