{"action":"created","comment":{"url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/comments/54129350","id":54129350,"diff_hunk":"@@ -91,17 +96,48 @@ module.exports = Backbone.View.extend({\n   },\n \n   handleSocketMessage: function(response) {\n-    var data = JSON.parse(response.data);\n-    if(data.id == this.socketNotificationID){\n-      console.log(data);\n-    }\n-  },\n+    var data = JSON.parse(response.data),\n+        username,\n+        avatar,\n+        n;\n+\n+    if (data.hasOwnProperty('notification')) {\n+      n = data.notification;\n+      username = n.handle ? n.handle : n.guid.substring(0,10) + '...';\n+      avatar = n.image_hash ? app.serverConfig.getServerBaseUrl + '/get_image?hash=' +\n+        n.image_hash + '&guid=' + n.guid : 'imgs/defaultUser.png';\n+","path":"js/views/pageNavVw.js","position":92,"original_position":92,"commit_id":"884b7211f76d20cc8fbbb68e9e25999b59e8d4d2","original_commit_id":"884b7211f76d20cc8fbbb68e9e25999b59e8d4d2","user":{"login":"rmisio","id":794517,"avatar_url":"https://avatars.githubusercontent.com/u/794517?v=3","gravatar_id":"","url":"https://api.github.com/users/rmisio","html_url":"https://github.com/rmisio","followers_url":"https://api.github.com/users/rmisio/followers","following_url":"https://api.github.com/users/rmisio/following{/other_user}","gists_url":"https://api.github.com/users/rmisio/gists{/gist_id}","starred_url":"https://api.github.com/users/rmisio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmisio/subscriptions","organizations_url":"https://api.github.com/users/rmisio/orgs","repos_url":"https://api.github.com/users/rmisio/repos","events_url":"https://api.github.com/users/rmisio/events{/privacy}","received_events_url":"https://api.github.com/users/rmisio/received_events","type":"User","site_admin":false},"body":"hmm... yeah, a lot of this code I just re-used and didn't tweak too much. I'll think about updating the model. I'm quite hesitant because in general we're not using models correctly. Any state that is purely for display purposes should really either be switched by the view or done in the template. Models are pieces of data that are intended to be used by many different views and we shouldn't be corrupting them with display state that is only relevant for some views. For example, we may want to pass the model to a view that spans the width of the browser which would want the full username.\r\n\r\nIt's a very common practice in a backbone app to have models and collections provided by the router (or some centralized place). That way the data can be passed to any number of views. The centralized place handles the fetching so each view that requires the same data doesn't need to instantiate new models or collections and hit the server for data that we already have.","created_at":"2016-02-25T17:13:23Z","updated_at":"2016-02-25T17:13:23Z","html_url":"https://github.com/OpenBazaar/OpenBazaar-Client/pull/792#discussion_r54129350","pull_request_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792","_links":{"self":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/comments/54129350"},"html":{"href":"https://github.com/OpenBazaar/OpenBazaar-Client/pull/792#discussion_r54129350"},"pull_request":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792"}}},"pull_request":{"url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792","id":60589365,"html_url":"https://github.com/OpenBazaar/OpenBazaar-Client/pull/792","diff_url":"https://github.com/OpenBazaar/OpenBazaar-Client/pull/792.diff","patch_url":"https://github.com/OpenBazaar/OpenBazaar-Client/pull/792.patch","issue_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues/792","number":792,"state":"open","locked":false,"title":"Notif refactor","user":{"login":"rmisio","id":794517,"avatar_url":"https://avatars.githubusercontent.com/u/794517?v=3","gravatar_id":"","url":"https://api.github.com/users/rmisio","html_url":"https://github.com/rmisio","followers_url":"https://api.github.com/users/rmisio/followers","following_url":"https://api.github.com/users/rmisio/following{/other_user}","gists_url":"https://api.github.com/users/rmisio/gists{/gist_id}","starred_url":"https://api.github.com/users/rmisio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmisio/subscriptions","organizations_url":"https://api.github.com/users/rmisio/orgs","repos_url":"https://api.github.com/users/rmisio/repos","events_url":"https://api.github.com/users/rmisio/events{/privacy}","received_events_url":"https://api.github.com/users/rmisio/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-24T22:21:53Z","updated_at":"2016-02-25T17:13:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25017ffb83b79c482b48319a0c3943260f67c489","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792/commits","review_comments_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792/comments","review_comment_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues/792/comments","statuses_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/statuses/884b7211f76d20cc8fbbb68e9e25999b59e8d4d2","head":{"label":"rmisio:notif-refactor","ref":"notif-refactor","sha":"884b7211f76d20cc8fbbb68e9e25999b59e8d4d2","user":{"login":"rmisio","id":794517,"avatar_url":"https://avatars.githubusercontent.com/u/794517?v=3","gravatar_id":"","url":"https://api.github.com/users/rmisio","html_url":"https://github.com/rmisio","followers_url":"https://api.github.com/users/rmisio/followers","following_url":"https://api.github.com/users/rmisio/following{/other_user}","gists_url":"https://api.github.com/users/rmisio/gists{/gist_id}","starred_url":"https://api.github.com/users/rmisio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmisio/subscriptions","organizations_url":"https://api.github.com/users/rmisio/orgs","repos_url":"https://api.github.com/users/rmisio/repos","events_url":"https://api.github.com/users/rmisio/events{/privacy}","received_events_url":"https://api.github.com/users/rmisio/received_events","type":"User","site_admin":false},"repo":{"id":49665414,"name":"OpenBazaar-Client","full_name":"rmisio/OpenBazaar-Client","owner":{"login":"rmisio","id":794517,"avatar_url":"https://avatars.githubusercontent.com/u/794517?v=3","gravatar_id":"","url":"https://api.github.com/users/rmisio","html_url":"https://github.com/rmisio","followers_url":"https://api.github.com/users/rmisio/followers","following_url":"https://api.github.com/users/rmisio/following{/other_user}","gists_url":"https://api.github.com/users/rmisio/gists{/gist_id}","starred_url":"https://api.github.com/users/rmisio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmisio/subscriptions","organizations_url":"https://api.github.com/users/rmisio/orgs","repos_url":"https://api.github.com/users/rmisio/repos","events_url":"https://api.github.com/users/rmisio/events{/privacy}","received_events_url":"https://api.github.com/users/rmisio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rmisio/OpenBazaar-Client","description":"Front-end Electron application for talking with the OpenBazaar-Server daemon","fork":true,"url":"https://api.github.com/repos/rmisio/OpenBazaar-Client","forks_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/forks","keys_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/teams","hooks_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/hooks","issue_events_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/issues/events{/number}","events_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/events","assignees_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/assignees{/user}","branches_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/branches{/branch}","tags_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/tags","blobs_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/git/refs{/sha}","trees_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/statuses/{sha}","languages_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/languages","stargazers_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/stargazers","contributors_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/contributors","subscribers_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/subscribers","subscription_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/subscription","commits_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/commits{/sha}","git_commits_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/git/commits{/sha}","comments_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/comments{/number}","issue_comment_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/issues/comments{/number}","contents_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/contents/{+path}","compare_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/merges","archive_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/downloads","issues_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/issues{/number}","pulls_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/pulls{/number}","milestones_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/milestones{/number}","notifications_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/labels{/name}","releases_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/releases{/id}","deployments_url":"https://api.github.com/repos/rmisio/OpenBazaar-Client/deployments","created_at":"2016-01-14T18:09:13Z","updated_at":"2016-01-14T18:09:14Z","pushed_at":"2016-02-25T01:18:53Z","git_url":"git://github.com/rmisio/OpenBazaar-Client.git","ssh_url":"git@github.com:rmisio/OpenBazaar-Client.git","clone_url":"https://github.com/rmisio/OpenBazaar-Client.git","svn_url":"https://github.com/rmisio/OpenBazaar-Client","homepage":"","size":25487,"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":"OpenBazaar:master","ref":"master","sha":"5d581a7a6ef37763d1a2afccec58a8e22a6ace43","user":{"login":"OpenBazaar","id":7438770,"avatar_url":"https://avatars.githubusercontent.com/u/7438770?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenBazaar","html_url":"https://github.com/OpenBazaar","followers_url":"https://api.github.com/users/OpenBazaar/followers","following_url":"https://api.github.com/users/OpenBazaar/following{/other_user}","gists_url":"https://api.github.com/users/OpenBazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenBazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenBazaar/subscriptions","organizations_url":"https://api.github.com/users/OpenBazaar/orgs","repos_url":"https://api.github.com/users/OpenBazaar/repos","events_url":"https://api.github.com/users/OpenBazaar/events{/privacy}","received_events_url":"https://api.github.com/users/OpenBazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":40909050,"name":"OpenBazaar-Client","full_name":"OpenBazaar/OpenBazaar-Client","owner":{"login":"OpenBazaar","id":7438770,"avatar_url":"https://avatars.githubusercontent.com/u/7438770?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenBazaar","html_url":"https://github.com/OpenBazaar","followers_url":"https://api.github.com/users/OpenBazaar/followers","following_url":"https://api.github.com/users/OpenBazaar/following{/other_user}","gists_url":"https://api.github.com/users/OpenBazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenBazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenBazaar/subscriptions","organizations_url":"https://api.github.com/users/OpenBazaar/orgs","repos_url":"https://api.github.com/users/OpenBazaar/repos","events_url":"https://api.github.com/users/OpenBazaar/events{/privacy}","received_events_url":"https://api.github.com/users/OpenBazaar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenBazaar/OpenBazaar-Client","description":"Front-end Electron application for talking with the OpenBazaar-Server daemon","fork":false,"url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client","forks_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/forks","keys_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/teams","hooks_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/hooks","issue_events_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues/events{/number}","events_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/events","assignees_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/assignees{/user}","branches_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/branches{/branch}","tags_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/tags","blobs_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/languages","stargazers_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/stargazers","contributors_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/contributors","subscribers_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/subscribers","subscription_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/subscription","commits_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/contents/{+path}","compare_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/merges","archive_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/downloads","issues_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues{/number}","pulls_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/labels{/name}","releases_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/releases{/id}","deployments_url":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/deployments","created_at":"2015-08-17T16:11:12Z","updated_at":"2016-02-24T11:29:24Z","pushed_at":"2016-02-25T02:05:33Z","git_url":"git://github.com/OpenBazaar/OpenBazaar-Client.git","ssh_url":"git@github.com:OpenBazaar/OpenBazaar-Client.git","clone_url":"https://github.com/OpenBazaar/OpenBazaar-Client.git","svn_url":"https://github.com/OpenBazaar/OpenBazaar-Client","homepage":"","size":25536,"stargazers_count":143,"watchers_count":143,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":77,"mirror_url":null,"open_issues_count":92,"forks":77,"open_issues":92,"watchers":143,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792"},"html":{"href":"https://github.com/OpenBazaar/OpenBazaar-Client/pull/792"},"issue":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues/792"},"comments":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/issues/792/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/pulls/792/commits"},"statuses":{"href":"https://api.github.com/repos/OpenBazaar/OpenBazaar-Client/statuses/884b7211f76d20cc8fbbb68e9e25999b59e8d4d2"}}}}