{"action":"created","comment":{"url":"https://api.github.com/repos/aromatt/jub.dj/pulls/comments/41946814","id":41946814,"diff_hunk":"@@ -103,8 +106,17 @@ script.\n \n     console.log('received chat', msg_obj);\n     var list = $('#messages');\n-    var chat_li = new_chat_li(msg_obj);\n-    list.append(chat_li);\n+    if(msg_obj.user != last_user) {\n+      var chat_li = new_chat_li(msg_obj);\n+      list.append(chat_li);\n+    } else {\n+      for (line of msg_obj.text.split('\\n')) {\n+        list[0].getElementsByTagName(\"li\")[list[0].getElementsByTagName(\"li\").length - 1].innerHTML += '<br>' + line;","path":"views/chat.jade","position":63,"original_position":63,"commit_id":"e01b95e69bfaad15a88ada9d2a5e5d8f61afe500","original_commit_id":"e01b95e69bfaad15a88ada9d2a5e5d8f61afe500","user":{"login":"aromatt","id":3900440,"avatar_url":"https://avatars.githubusercontent.com/u/3900440?v=3","gravatar_id":"","url":"https://api.github.com/users/aromatt","html_url":"https://github.com/aromatt","followers_url":"https://api.github.com/users/aromatt/followers","following_url":"https://api.github.com/users/aromatt/following{/other_user}","gists_url":"https://api.github.com/users/aromatt/gists{/gist_id}","starred_url":"https://api.github.com/users/aromatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aromatt/subscriptions","organizations_url":"https://api.github.com/users/aromatt/orgs","repos_url":"https://api.github.com/users/aromatt/repos","events_url":"https://api.github.com/users/aromatt/events{/privacy}","received_events_url":"https://api.github.com/users/aromatt/received_events","type":"User","site_admin":false},"body":"A couple notes here:\r\n1.  jquery gives you some shortcuts to more clearly state what you're getting.  I think `list.find('li').last()` would give you the last `li`, in a more succinct and self-explanatory way.\r\n\r\n2.  I'm opposed to using `innerHTML` here for security reasons.  I'm pretty sure this would enable someone to craft a chat message that would load and execute arbitrary javascript in all the other users' browsers... for inserting text onto the page I think there safe options (like `createTextNode` above).  Would you mind doing something more like that?","created_at":"2015-10-14T01:24:31Z","updated_at":"2015-10-14T01:24:31Z","html_url":"https://github.com/aromatt/jub.dj/pull/76#discussion_r41946814","pull_request_url":"https://api.github.com/repos/aromatt/jub.dj/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/aromatt/jub.dj/pulls/comments/41946814"},"html":{"href":"https://github.com/aromatt/jub.dj/pull/76#discussion_r41946814"},"pull_request":{"href":"https://api.github.com/repos/aromatt/jub.dj/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/aromatt/jub.dj/pulls/76","id":47602335,"html_url":"https://github.com/aromatt/jub.dj/pull/76","diff_url":"https://github.com/aromatt/jub.dj/pull/76.diff","patch_url":"https://github.com/aromatt/jub.dj/pull/76.patch","issue_url":"https://api.github.com/repos/aromatt/jub.dj/issues/76","number":76,"state":"open","locked":false,"title":"Fixes #28. Consecutive messages by same user","user":{"login":"croasus","id":3858269,"avatar_url":"https://avatars.githubusercontent.com/u/3858269?v=3","gravatar_id":"","url":"https://api.github.com/users/croasus","html_url":"https://github.com/croasus","followers_url":"https://api.github.com/users/croasus/followers","following_url":"https://api.github.com/users/croasus/following{/other_user}","gists_url":"https://api.github.com/users/croasus/gists{/gist_id}","starred_url":"https://api.github.com/users/croasus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/croasus/subscriptions","organizations_url":"https://api.github.com/users/croasus/orgs","repos_url":"https://api.github.com/users/croasus/repos","events_url":"https://api.github.com/users/croasus/events{/privacy}","received_events_url":"https://api.github.com/users/croasus/received_events","type":"User","site_admin":false},"body":"Consecutive messages by same user does not trigger a new line with user's name","created_at":"2015-10-13T23:34:47Z","updated_at":"2015-10-14T01:24:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"327cc6f154e4f77401abd2de4ee22664da286867","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aromatt/jub.dj/pulls/76/commits","review_comments_url":"https://api.github.com/repos/aromatt/jub.dj/pulls/76/comments","review_comment_url":"https://api.github.com/repos/aromatt/jub.dj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aromatt/jub.dj/issues/76/comments","statuses_url":"https://api.github.com/repos/aromatt/jub.dj/statuses/e01b95e69bfaad15a88ada9d2a5e5d8f61afe500","head":{"label":"croasus:master","ref":"master","sha":"e01b95e69bfaad15a88ada9d2a5e5d8f61afe500","user":{"login":"croasus","id":3858269,"avatar_url":"https://avatars.githubusercontent.com/u/3858269?v=3","gravatar_id":"","url":"https://api.github.com/users/croasus","html_url":"https://github.com/croasus","followers_url":"https://api.github.com/users/croasus/followers","following_url":"https://api.github.com/users/croasus/following{/other_user}","gists_url":"https://api.github.com/users/croasus/gists{/gist_id}","starred_url":"https://api.github.com/users/croasus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/croasus/subscriptions","organizations_url":"https://api.github.com/users/croasus/orgs","repos_url":"https://api.github.com/users/croasus/repos","events_url":"https://api.github.com/users/croasus/events{/privacy}","received_events_url":"https://api.github.com/users/croasus/received_events","type":"User","site_admin":false},"repo":{"id":43516132,"name":"jub.dj","full_name":"croasus/jub.dj","owner":{"login":"croasus","id":3858269,"avatar_url":"https://avatars.githubusercontent.com/u/3858269?v=3","gravatar_id":"","url":"https://api.github.com/users/croasus","html_url":"https://github.com/croasus","followers_url":"https://api.github.com/users/croasus/followers","following_url":"https://api.github.com/users/croasus/following{/other_user}","gists_url":"https://api.github.com/users/croasus/gists{/gist_id}","starred_url":"https://api.github.com/users/croasus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/croasus/subscriptions","organizations_url":"https://api.github.com/users/croasus/orgs","repos_url":"https://api.github.com/users/croasus/repos","events_url":"https://api.github.com/users/croasus/events{/privacy}","received_events_url":"https://api.github.com/users/croasus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/croasus/jub.dj","description":"chat + shared video","fork":true,"url":"https://api.github.com/repos/croasus/jub.dj","forks_url":"https://api.github.com/repos/croasus/jub.dj/forks","keys_url":"https://api.github.com/repos/croasus/jub.dj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/croasus/jub.dj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/croasus/jub.dj/teams","hooks_url":"https://api.github.com/repos/croasus/jub.dj/hooks","issue_events_url":"https://api.github.com/repos/croasus/jub.dj/issues/events{/number}","events_url":"https://api.github.com/repos/croasus/jub.dj/events","assignees_url":"https://api.github.com/repos/croasus/jub.dj/assignees{/user}","branches_url":"https://api.github.com/repos/croasus/jub.dj/branches{/branch}","tags_url":"https://api.github.com/repos/croasus/jub.dj/tags","blobs_url":"https://api.github.com/repos/croasus/jub.dj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/croasus/jub.dj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/croasus/jub.dj/git/refs{/sha}","trees_url":"https://api.github.com/repos/croasus/jub.dj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/croasus/jub.dj/statuses/{sha}","languages_url":"https://api.github.com/repos/croasus/jub.dj/languages","stargazers_url":"https://api.github.com/repos/croasus/jub.dj/stargazers","contributors_url":"https://api.github.com/repos/croasus/jub.dj/contributors","subscribers_url":"https://api.github.com/repos/croasus/jub.dj/subscribers","subscription_url":"https://api.github.com/repos/croasus/jub.dj/subscription","commits_url":"https://api.github.com/repos/croasus/jub.dj/commits{/sha}","git_commits_url":"https://api.github.com/repos/croasus/jub.dj/git/commits{/sha}","comments_url":"https://api.github.com/repos/croasus/jub.dj/comments{/number}","issue_comment_url":"https://api.github.com/repos/croasus/jub.dj/issues/comments{/number}","contents_url":"https://api.github.com/repos/croasus/jub.dj/contents/{+path}","compare_url":"https://api.github.com/repos/croasus/jub.dj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/croasus/jub.dj/merges","archive_url":"https://api.github.com/repos/croasus/jub.dj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/croasus/jub.dj/downloads","issues_url":"https://api.github.com/repos/croasus/jub.dj/issues{/number}","pulls_url":"https://api.github.com/repos/croasus/jub.dj/pulls{/number}","milestones_url":"https://api.github.com/repos/croasus/jub.dj/milestones{/number}","notifications_url":"https://api.github.com/repos/croasus/jub.dj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/croasus/jub.dj/labels{/name}","releases_url":"https://api.github.com/repos/croasus/jub.dj/releases{/id}","created_at":"2015-10-01T19:23:20Z","updated_at":"2015-10-01T19:23:21Z","pushed_at":"2015-10-13T23:34:46Z","git_url":"git://github.com/croasus/jub.dj.git","ssh_url":"git@github.com:croasus/jub.dj.git","clone_url":"https://github.com/croasus/jub.dj.git","svn_url":"https://github.com/croasus/jub.dj","homepage":null,"size":515,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aromatt:master","ref":"master","sha":"68602e6ff43531e69d62d46f7d021f324ea732e2","user":{"login":"aromatt","id":3900440,"avatar_url":"https://avatars.githubusercontent.com/u/3900440?v=3","gravatar_id":"","url":"https://api.github.com/users/aromatt","html_url":"https://github.com/aromatt","followers_url":"https://api.github.com/users/aromatt/followers","following_url":"https://api.github.com/users/aromatt/following{/other_user}","gists_url":"https://api.github.com/users/aromatt/gists{/gist_id}","starred_url":"https://api.github.com/users/aromatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aromatt/subscriptions","organizations_url":"https://api.github.com/users/aromatt/orgs","repos_url":"https://api.github.com/users/aromatt/repos","events_url":"https://api.github.com/users/aromatt/events{/privacy}","received_events_url":"https://api.github.com/users/aromatt/received_events","type":"User","site_admin":false},"repo":{"id":43335212,"name":"jub.dj","full_name":"aromatt/jub.dj","owner":{"login":"aromatt","id":3900440,"avatar_url":"https://avatars.githubusercontent.com/u/3900440?v=3","gravatar_id":"","url":"https://api.github.com/users/aromatt","html_url":"https://github.com/aromatt","followers_url":"https://api.github.com/users/aromatt/followers","following_url":"https://api.github.com/users/aromatt/following{/other_user}","gists_url":"https://api.github.com/users/aromatt/gists{/gist_id}","starred_url":"https://api.github.com/users/aromatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aromatt/subscriptions","organizations_url":"https://api.github.com/users/aromatt/orgs","repos_url":"https://api.github.com/users/aromatt/repos","events_url":"https://api.github.com/users/aromatt/events{/privacy}","received_events_url":"https://api.github.com/users/aromatt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aromatt/jub.dj","description":"chat + shared video","fork":false,"url":"https://api.github.com/repos/aromatt/jub.dj","forks_url":"https://api.github.com/repos/aromatt/jub.dj/forks","keys_url":"https://api.github.com/repos/aromatt/jub.dj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aromatt/jub.dj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aromatt/jub.dj/teams","hooks_url":"https://api.github.com/repos/aromatt/jub.dj/hooks","issue_events_url":"https://api.github.com/repos/aromatt/jub.dj/issues/events{/number}","events_url":"https://api.github.com/repos/aromatt/jub.dj/events","assignees_url":"https://api.github.com/repos/aromatt/jub.dj/assignees{/user}","branches_url":"https://api.github.com/repos/aromatt/jub.dj/branches{/branch}","tags_url":"https://api.github.com/repos/aromatt/jub.dj/tags","blobs_url":"https://api.github.com/repos/aromatt/jub.dj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aromatt/jub.dj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aromatt/jub.dj/git/refs{/sha}","trees_url":"https://api.github.com/repos/aromatt/jub.dj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aromatt/jub.dj/statuses/{sha}","languages_url":"https://api.github.com/repos/aromatt/jub.dj/languages","stargazers_url":"https://api.github.com/repos/aromatt/jub.dj/stargazers","contributors_url":"https://api.github.com/repos/aromatt/jub.dj/contributors","subscribers_url":"https://api.github.com/repos/aromatt/jub.dj/subscribers","subscription_url":"https://api.github.com/repos/aromatt/jub.dj/subscription","commits_url":"https://api.github.com/repos/aromatt/jub.dj/commits{/sha}","git_commits_url":"https://api.github.com/repos/aromatt/jub.dj/git/commits{/sha}","comments_url":"https://api.github.com/repos/aromatt/jub.dj/comments{/number}","issue_comment_url":"https://api.github.com/repos/aromatt/jub.dj/issues/comments{/number}","contents_url":"https://api.github.com/repos/aromatt/jub.dj/contents/{+path}","compare_url":"https://api.github.com/repos/aromatt/jub.dj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aromatt/jub.dj/merges","archive_url":"https://api.github.com/repos/aromatt/jub.dj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aromatt/jub.dj/downloads","issues_url":"https://api.github.com/repos/aromatt/jub.dj/issues{/number}","pulls_url":"https://api.github.com/repos/aromatt/jub.dj/pulls{/number}","milestones_url":"https://api.github.com/repos/aromatt/jub.dj/milestones{/number}","notifications_url":"https://api.github.com/repos/aromatt/jub.dj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aromatt/jub.dj/labels{/name}","releases_url":"https://api.github.com/repos/aromatt/jub.dj/releases{/id}","created_at":"2015-09-29T00:31:20Z","updated_at":"2015-09-29T00:32:08Z","pushed_at":"2015-10-13T23:34:47Z","git_url":"git://github.com/aromatt/jub.dj.git","ssh_url":"git@github.com:aromatt/jub.dj.git","clone_url":"https://github.com/aromatt/jub.dj.git","svn_url":"https://github.com/aromatt/jub.dj","homepage":null,"size":669,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":36,"forks":2,"open_issues":36,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aromatt/jub.dj/pulls/76"},"html":{"href":"https://github.com/aromatt/jub.dj/pull/76"},"issue":{"href":"https://api.github.com/repos/aromatt/jub.dj/issues/76"},"comments":{"href":"https://api.github.com/repos/aromatt/jub.dj/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/aromatt/jub.dj/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/aromatt/jub.dj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aromatt/jub.dj/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/aromatt/jub.dj/statuses/e01b95e69bfaad15a88ada9d2a5e5d8f61afe500"}}}}