{"action":"created","comment":{"url":"https://api.github.com/repos/neroma/neroma-chat/pulls/comments/33908488","id":33908488,"diff_hunk":"@@ -8,13 +10,25 @@ chat.factory('Messages', function($rootScope, socket) {\n     var success = socket.emit('messages.send', data);\n   };\n \n-  socket.on('message', function(message) {\n-    $rootScope.$apply(function() { services.data.push(message); });\n+  socket.on('message', function(data) {\n+    receiveMessage(data);\n   });\n \n+  var receiveMessage = function(data) {\n+    var message = Object.create(data);","path":"statics/js/src/message.js","position":17,"original_position":17,"commit_id":"455cc8a8400dc1033d8cb1dd9e380716f257fbfb","original_commit_id":"455cc8a8400dc1033d8cb1dd9e380716f257fbfb","user":{"login":"rongduan-zhu","id":5406634,"avatar_url":"https://avatars.githubusercontent.com/u/5406634?v=3","gravatar_id":"","url":"https://api.github.com/users/rongduan-zhu","html_url":"https://github.com/rongduan-zhu","followers_url":"https://api.github.com/users/rongduan-zhu/followers","following_url":"https://api.github.com/users/rongduan-zhu/following{/other_user}","gists_url":"https://api.github.com/users/rongduan-zhu/gists{/gist_id}","starred_url":"https://api.github.com/users/rongduan-zhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rongduan-zhu/subscriptions","organizations_url":"https://api.github.com/users/rongduan-zhu/orgs","repos_url":"https://api.github.com/users/rongduan-zhu/repos","events_url":"https://api.github.com/users/rongduan-zhu/events{/privacy}","received_events_url":"https://api.github.com/users/rongduan-zhu/received_events","type":"User","site_admin":false},"body":"why create a new copy here?","created_at":"2015-07-06T06:28:10Z","updated_at":"2015-07-06T06:28:10Z","html_url":"https://github.com/neroma/neroma-chat/pull/17#discussion_r33908488","pull_request_url":"https://api.github.com/repos/neroma/neroma-chat/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/neroma/neroma-chat/pulls/comments/33908488"},"html":{"href":"https://github.com/neroma/neroma-chat/pull/17#discussion_r33908488"},"pull_request":{"href":"https://api.github.com/repos/neroma/neroma-chat/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/neroma/neroma-chat/pulls/17","id":39206728,"html_url":"https://github.com/neroma/neroma-chat/pull/17","diff_url":"https://github.com/neroma/neroma-chat/pull/17.diff","patch_url":"https://github.com/neroma/neroma-chat/pull/17.patch","issue_url":"https://api.github.com/repos/neroma/neroma-chat/issues/17","number":17,"state":"open","locked":false,"title":"Added timestamps to messages.","user":{"login":"nedp","id":6904248,"avatar_url":"https://avatars.githubusercontent.com/u/6904248?v=3","gravatar_id":"","url":"https://api.github.com/users/nedp","html_url":"https://github.com/nedp","followers_url":"https://api.github.com/users/nedp/followers","following_url":"https://api.github.com/users/nedp/following{/other_user}","gists_url":"https://api.github.com/users/nedp/gists{/gist_id}","starred_url":"https://api.github.com/users/nedp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nedp/subscriptions","organizations_url":"https://api.github.com/users/nedp/orgs","repos_url":"https://api.github.com/users/nedp/repos","events_url":"https://api.github.com/users/nedp/events{/privacy}","received_events_url":"https://api.github.com/users/nedp/received_events","type":"User","site_admin":false},"body":"Timestamps are calculated client side upon receiving a message.\r\n\r\n* Added receiveMessage to the Messages module to do any necessary\r\n  processing to incoming messages.\r\n  For now, this just adds the timestamp.\r\n  It is exported.\r\n* Modified the main page template to include the timestamps.\r\n* Added unit tests to verify the behaviour of receiveMessage.","created_at":"2015-07-04T11:48:28Z","updated_at":"2015-07-06T06:28:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"387841050e45c98c64c0dbf49f64ba0bd93f95cc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neroma/neroma-chat/pulls/17/commits","review_comments_url":"https://api.github.com/repos/neroma/neroma-chat/pulls/17/comments","review_comment_url":"https://api.github.com/repos/neroma/neroma-chat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neroma/neroma-chat/issues/17/comments","statuses_url":"https://api.github.com/repos/neroma/neroma-chat/statuses/455cc8a8400dc1033d8cb1dd9e380716f257fbfb","head":{"label":"neroma:nedp/timestamp","ref":"nedp/timestamp","sha":"455cc8a8400dc1033d8cb1dd9e380716f257fbfb","user":{"login":"neroma","id":12774950,"avatar_url":"https://avatars.githubusercontent.com/u/12774950?v=3","gravatar_id":"","url":"https://api.github.com/users/neroma","html_url":"https://github.com/neroma","followers_url":"https://api.github.com/users/neroma/followers","following_url":"https://api.github.com/users/neroma/following{/other_user}","gists_url":"https://api.github.com/users/neroma/gists{/gist_id}","starred_url":"https://api.github.com/users/neroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neroma/subscriptions","organizations_url":"https://api.github.com/users/neroma/orgs","repos_url":"https://api.github.com/users/neroma/repos","events_url":"https://api.github.com/users/neroma/events{/privacy}","received_events_url":"https://api.github.com/users/neroma/received_events","type":"Organization","site_admin":false},"repo":{"id":36981136,"name":"neroma-chat","full_name":"neroma/neroma-chat","owner":{"login":"neroma","id":12774950,"avatar_url":"https://avatars.githubusercontent.com/u/12774950?v=3","gravatar_id":"","url":"https://api.github.com/users/neroma","html_url":"https://github.com/neroma","followers_url":"https://api.github.com/users/neroma/followers","following_url":"https://api.github.com/users/neroma/following{/other_user}","gists_url":"https://api.github.com/users/neroma/gists{/gist_id}","starred_url":"https://api.github.com/users/neroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neroma/subscriptions","organizations_url":"https://api.github.com/users/neroma/orgs","repos_url":"https://api.github.com/users/neroma/repos","events_url":"https://api.github.com/users/neroma/events{/privacy}","received_events_url":"https://api.github.com/users/neroma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neroma/neroma-chat","description":"","fork":false,"url":"https://api.github.com/repos/neroma/neroma-chat","forks_url":"https://api.github.com/repos/neroma/neroma-chat/forks","keys_url":"https://api.github.com/repos/neroma/neroma-chat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neroma/neroma-chat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neroma/neroma-chat/teams","hooks_url":"https://api.github.com/repos/neroma/neroma-chat/hooks","issue_events_url":"https://api.github.com/repos/neroma/neroma-chat/issues/events{/number}","events_url":"https://api.github.com/repos/neroma/neroma-chat/events","assignees_url":"https://api.github.com/repos/neroma/neroma-chat/assignees{/user}","branches_url":"https://api.github.com/repos/neroma/neroma-chat/branches{/branch}","tags_url":"https://api.github.com/repos/neroma/neroma-chat/tags","blobs_url":"https://api.github.com/repos/neroma/neroma-chat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neroma/neroma-chat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neroma/neroma-chat/git/refs{/sha}","trees_url":"https://api.github.com/repos/neroma/neroma-chat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neroma/neroma-chat/statuses/{sha}","languages_url":"https://api.github.com/repos/neroma/neroma-chat/languages","stargazers_url":"https://api.github.com/repos/neroma/neroma-chat/stargazers","contributors_url":"https://api.github.com/repos/neroma/neroma-chat/contributors","subscribers_url":"https://api.github.com/repos/neroma/neroma-chat/subscribers","subscription_url":"https://api.github.com/repos/neroma/neroma-chat/subscription","commits_url":"https://api.github.com/repos/neroma/neroma-chat/commits{/sha}","git_commits_url":"https://api.github.com/repos/neroma/neroma-chat/git/commits{/sha}","comments_url":"https://api.github.com/repos/neroma/neroma-chat/comments{/number}","issue_comment_url":"https://api.github.com/repos/neroma/neroma-chat/issues/comments{/number}","contents_url":"https://api.github.com/repos/neroma/neroma-chat/contents/{+path}","compare_url":"https://api.github.com/repos/neroma/neroma-chat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neroma/neroma-chat/merges","archive_url":"https://api.github.com/repos/neroma/neroma-chat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neroma/neroma-chat/downloads","issues_url":"https://api.github.com/repos/neroma/neroma-chat/issues{/number}","pulls_url":"https://api.github.com/repos/neroma/neroma-chat/pulls{/number}","milestones_url":"https://api.github.com/repos/neroma/neroma-chat/milestones{/number}","notifications_url":"https://api.github.com/repos/neroma/neroma-chat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neroma/neroma-chat/labels{/name}","releases_url":"https://api.github.com/repos/neroma/neroma-chat/releases{/id}","created_at":"2015-06-06T13:34:31Z","updated_at":"2015-06-06T13:56:31Z","pushed_at":"2015-07-06T05:32:07Z","git_url":"git://github.com/neroma/neroma-chat.git","ssh_url":"git@github.com:neroma/neroma-chat.git","clone_url":"https://github.com/neroma/neroma-chat.git","svn_url":"https://github.com/neroma/neroma-chat","homepage":null,"size":452,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"neroma:master","ref":"master","sha":"d9ae47a847e8d34802984eda09a77724788b8219","user":{"login":"neroma","id":12774950,"avatar_url":"https://avatars.githubusercontent.com/u/12774950?v=3","gravatar_id":"","url":"https://api.github.com/users/neroma","html_url":"https://github.com/neroma","followers_url":"https://api.github.com/users/neroma/followers","following_url":"https://api.github.com/users/neroma/following{/other_user}","gists_url":"https://api.github.com/users/neroma/gists{/gist_id}","starred_url":"https://api.github.com/users/neroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neroma/subscriptions","organizations_url":"https://api.github.com/users/neroma/orgs","repos_url":"https://api.github.com/users/neroma/repos","events_url":"https://api.github.com/users/neroma/events{/privacy}","received_events_url":"https://api.github.com/users/neroma/received_events","type":"Organization","site_admin":false},"repo":{"id":36981136,"name":"neroma-chat","full_name":"neroma/neroma-chat","owner":{"login":"neroma","id":12774950,"avatar_url":"https://avatars.githubusercontent.com/u/12774950?v=3","gravatar_id":"","url":"https://api.github.com/users/neroma","html_url":"https://github.com/neroma","followers_url":"https://api.github.com/users/neroma/followers","following_url":"https://api.github.com/users/neroma/following{/other_user}","gists_url":"https://api.github.com/users/neroma/gists{/gist_id}","starred_url":"https://api.github.com/users/neroma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neroma/subscriptions","organizations_url":"https://api.github.com/users/neroma/orgs","repos_url":"https://api.github.com/users/neroma/repos","events_url":"https://api.github.com/users/neroma/events{/privacy}","received_events_url":"https://api.github.com/users/neroma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neroma/neroma-chat","description":"","fork":false,"url":"https://api.github.com/repos/neroma/neroma-chat","forks_url":"https://api.github.com/repos/neroma/neroma-chat/forks","keys_url":"https://api.github.com/repos/neroma/neroma-chat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neroma/neroma-chat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neroma/neroma-chat/teams","hooks_url":"https://api.github.com/repos/neroma/neroma-chat/hooks","issue_events_url":"https://api.github.com/repos/neroma/neroma-chat/issues/events{/number}","events_url":"https://api.github.com/repos/neroma/neroma-chat/events","assignees_url":"https://api.github.com/repos/neroma/neroma-chat/assignees{/user}","branches_url":"https://api.github.com/repos/neroma/neroma-chat/branches{/branch}","tags_url":"https://api.github.com/repos/neroma/neroma-chat/tags","blobs_url":"https://api.github.com/repos/neroma/neroma-chat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neroma/neroma-chat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neroma/neroma-chat/git/refs{/sha}","trees_url":"https://api.github.com/repos/neroma/neroma-chat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neroma/neroma-chat/statuses/{sha}","languages_url":"https://api.github.com/repos/neroma/neroma-chat/languages","stargazers_url":"https://api.github.com/repos/neroma/neroma-chat/stargazers","contributors_url":"https://api.github.com/repos/neroma/neroma-chat/contributors","subscribers_url":"https://api.github.com/repos/neroma/neroma-chat/subscribers","subscription_url":"https://api.github.com/repos/neroma/neroma-chat/subscription","commits_url":"https://api.github.com/repos/neroma/neroma-chat/commits{/sha}","git_commits_url":"https://api.github.com/repos/neroma/neroma-chat/git/commits{/sha}","comments_url":"https://api.github.com/repos/neroma/neroma-chat/comments{/number}","issue_comment_url":"https://api.github.com/repos/neroma/neroma-chat/issues/comments{/number}","contents_url":"https://api.github.com/repos/neroma/neroma-chat/contents/{+path}","compare_url":"https://api.github.com/repos/neroma/neroma-chat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neroma/neroma-chat/merges","archive_url":"https://api.github.com/repos/neroma/neroma-chat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neroma/neroma-chat/downloads","issues_url":"https://api.github.com/repos/neroma/neroma-chat/issues{/number}","pulls_url":"https://api.github.com/repos/neroma/neroma-chat/pulls{/number}","milestones_url":"https://api.github.com/repos/neroma/neroma-chat/milestones{/number}","notifications_url":"https://api.github.com/repos/neroma/neroma-chat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neroma/neroma-chat/labels{/name}","releases_url":"https://api.github.com/repos/neroma/neroma-chat/releases{/id}","created_at":"2015-06-06T13:34:31Z","updated_at":"2015-06-06T13:56:31Z","pushed_at":"2015-07-06T05:32:07Z","git_url":"git://github.com/neroma/neroma-chat.git","ssh_url":"git@github.com:neroma/neroma-chat.git","clone_url":"https://github.com/neroma/neroma-chat.git","svn_url":"https://github.com/neroma/neroma-chat","homepage":null,"size":452,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neroma/neroma-chat/pulls/17"},"html":{"href":"https://github.com/neroma/neroma-chat/pull/17"},"issue":{"href":"https://api.github.com/repos/neroma/neroma-chat/issues/17"},"comments":{"href":"https://api.github.com/repos/neroma/neroma-chat/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/neroma/neroma-chat/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/neroma/neroma-chat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neroma/neroma-chat/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/neroma/neroma-chat/statuses/455cc8a8400dc1033d8cb1dd9e380716f257fbfb"}}}}