GitHub PullRequestReviewCommentEvent at 2014-08-21 17:52:03
Repository: stellar-viewer
Actor: lsamayoa
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/stellar/stellar-viewer/pulls/comments/16555177","id":16555177,"diff_hunk":"@@ -99,10 +101,62 @@ stellarExplorer.controller('appController', function($scope, $q, requestHelper,\n     };\n   }\n \n-  requestHelper.setDefaultCallback(function() {\n-    $scope.requestAccountData(true);\n+  requestHelper.setDefaultCallback(function(message) {\n+    handleMessage(message);\n   });\n \n+\n+  // TODO: extract message handling to service\n+  // IDEA: Custom event emitter Service (Pub/Sub)\n+  function handleMessage (message) {\n+    if(message.engine_result_code !== 0) return; // If the transaction did not succeed let's bounce!\n+    \n+    // Any modifications to the queried account ?\n+    var affectedNode = _.find(message.meta.AffectedNodes, function (node) {\n+      return node.ModifiedNode.FinalFields.Account == $scope.query;\n+    });\n+    _.extend($scope.account_info, affectedNode.ModifiedNode.FinalFields);\n+\n+    switch(message.type){\n+      case 'transaction':\n+        // IDEA: Service.emit transaction event\n+        // IDEA: Service.subscribe('transaction', handleTransaction);\n+        handleTransaction(message.transaction);\n+        break;\n+      default:\n+        $scope.requestAccountData(true);\n+        break;\n+    }\n+  }\n+\n+  function handleTransaction(transaction){\n+    // If the transaction amount it's only a number they are microstellars.\n+    if(!isNaN(transaction.Amount)){\n+      transaction.Amount = {\n+        currency: 'STR',\n+        value: +dustToStellars(transaction.Amount) // Convert to stellars","path":"scripts/controllers/appController.js","position":55,"original_position":55,"commit_id":"bd929e2b1bd762ffb48aa638c8260bf4fac3e28f","original_commit_id":"bd929e2b1bd762ffb48aa638c8260bf4fac3e28f","user":{"login":"lsamayoa","id":3391985,"avatar_url":"https://avatars.githubusercontent.com/u/3391985?v=2","gravatar_id":"6de4a739f28866defb3d74057317e475","url":"https://api.github.com/users/lsamayoa","html_url":"https://github.com/lsamayoa","followers_url":"https://api.github.com/users/lsamayoa/followers","following_url":"https://api.github.com/users/lsamayoa/following{/other_user}","gists_url":"https://api.github.com/users/lsamayoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lsamayoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsamayoa/subscriptions","organizations_url":"https://api.github.com/users/lsamayoa/orgs","repos_url":"https://api.github.com/users/lsamayoa/repos","events_url":"https://api.github.com/users/lsamayoa/events{/privacy}","received_events_url":"https://api.github.com/users/lsamayoa/received_events","type":"User","site_admin":false},"body":"Should I use then the mSTR currency ?","created_at":"2014-08-21T17:52:03Z","updated_at":"2014-08-21T17:52:03Z","html_url":"https://github.com/stellar/stellar-viewer/pull/9#discussion_r16555177","pull_request_url":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/stellar/stellar-viewer/pulls/comments/16555177"},"html":{"href":"https://github.com/stellar/stellar-viewer/pull/9#discussion_r16555177"},"pull_request":{"href":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9","id":20085874,"html_url":"https://github.com/stellar/stellar-viewer/pull/9","diff_url":"https://github.com/stellar/stellar-viewer/pull/9.diff","patch_url":"https://github.com/stellar/stellar-viewer/pull/9.patch","issue_url":"https://api.github.com/repos/stellar/stellar-viewer/issues/9","number":9,"state":"open","locked":false,"title":"Multicurrency Websocket balance update","user":{"login":"lsamayoa","id":3391985,"avatar_url":"https://avatars.githubusercontent.com/u/3391985?v=2","gravatar_id":"6de4a739f28866defb3d74057317e475","url":"https://api.github.com/users/lsamayoa","html_url":"https://github.com/lsamayoa","followers_url":"https://api.github.com/users/lsamayoa/followers","following_url":"https://api.github.com/users/lsamayoa/following{/other_user}","gists_url":"https://api.github.com/users/lsamayoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lsamayoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsamayoa/subscriptions","organizations_url":"https://api.github.com/users/lsamayoa/orgs","repos_url":"https://api.github.com/users/lsamayoa/repos","events_url":"https://api.github.com/users/lsamayoa/events{/privacy}","received_events_url":"https://api.github.com/users/lsamayoa/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-08-21T01:59:24Z","updated_at":"2014-08-21T17:52:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"394f483ca21e4fb83939b1b0f364e18481d997c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9/commits","review_comments_url":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9/comments","review_comment_url":"https://api.github.com/repos/stellar/stellar-viewer/pulls/comments/{number}","comments_url":"https://api.github.com/repos/stellar/stellar-viewer/issues/9/comments","statuses_url":"https://api.github.com/repos/stellar/stellar-viewer/statuses/bd929e2b1bd762ffb48aa638c8260bf4fac3e28f","head":{"label":"lsamayoa:issue-3","ref":"issue-3","sha":"bd929e2b1bd762ffb48aa638c8260bf4fac3e28f","user":{"login":"lsamayoa","id":3391985,"avatar_url":"https://avatars.githubusercontent.com/u/3391985?v=2","gravatar_id":"6de4a739f28866defb3d74057317e475","url":"https://api.github.com/users/lsamayoa","html_url":"https://github.com/lsamayoa","followers_url":"https://api.github.com/users/lsamayoa/followers","following_url":"https://api.github.com/users/lsamayoa/following{/other_user}","gists_url":"https://api.github.com/users/lsamayoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lsamayoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsamayoa/subscriptions","organizations_url":"https://api.github.com/users/lsamayoa/orgs","repos_url":"https://api.github.com/users/lsamayoa/repos","events_url":"https://api.github.com/users/lsamayoa/events{/privacy}","received_events_url":"https://api.github.com/users/lsamayoa/received_events","type":"User","site_admin":false},"repo":{"id":22794497,"name":"stellar-viewer","full_name":"lsamayoa/stellar-viewer","owner":{"login":"lsamayoa","id":3391985,"avatar_url":"https://avatars.githubusercontent.com/u/3391985?v=2","gravatar_id":"6de4a739f28866defb3d74057317e475","url":"https://api.github.com/users/lsamayoa","html_url":"https://github.com/lsamayoa","followers_url":"https://api.github.com/users/lsamayoa/followers","following_url":"https://api.github.com/users/lsamayoa/following{/other_user}","gists_url":"https://api.github.com/users/lsamayoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lsamayoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsamayoa/subscriptions","organizations_url":"https://api.github.com/users/lsamayoa/orgs","repos_url":"https://api.github.com/users/lsamayoa/repos","events_url":"https://api.github.com/users/lsamayoa/events{/privacy}","received_events_url":"https://api.github.com/users/lsamayoa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lsamayoa/stellar-viewer","description":"Simple way to view stellar accounts.","fork":true,"url":"https://api.github.com/repos/lsamayoa/stellar-viewer","forks_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/forks","keys_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/teams","hooks_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/hooks","issue_events_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/issues/events{/number}","events_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/events","assignees_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/assignees{/user}","branches_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/branches{/branch}","tags_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/tags","blobs_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/statuses/{sha}","languages_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/languages","stargazers_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/stargazers","contributors_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/contributors","subscribers_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/subscribers","subscription_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/subscription","commits_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/issues/comments/{number}","contents_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/contents/{+path}","compare_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/merges","archive_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/downloads","issues_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/issues{/number}","pulls_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/pulls{/number}","milestones_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/milestones{/number}","notifications_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/labels{/name}","releases_url":"https://api.github.com/repos/lsamayoa/stellar-viewer/releases{/id}","created_at":"2014-08-09T20:28:24Z","updated_at":"2014-08-21T02:29:03Z","pushed_at":"2014-08-21T16:00:18Z","git_url":"git://github.com/lsamayoa/stellar-viewer.git","ssh_url":"git@github.com:lsamayoa/stellar-viewer.git","clone_url":"https://github.com/lsamayoa/stellar-viewer.git","svn_url":"https://github.com/lsamayoa/stellar-viewer","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"stellar:master","ref":"master","sha":"1d5ddef2092cc650fa1a952d9bbba4ba4cf19324","user":{"login":"stellar","id":7386716,"avatar_url":"https://avatars.githubusercontent.com/u/7386716?v=2","gravatar_id":"2b5253524ca198c6c564d0af966e34c3","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"repo":{"id":22449381,"name":"stellar-viewer","full_name":"stellar/stellar-viewer","owner":{"login":"stellar","id":7386716,"avatar_url":"https://avatars.githubusercontent.com/u/7386716?v=2","gravatar_id":"2b5253524ca198c6c564d0af966e34c3","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stellar/stellar-viewer","description":"Simple way to view stellar accounts.","fork":false,"url":"https://api.github.com/repos/stellar/stellar-viewer","forks_url":"https://api.github.com/repos/stellar/stellar-viewer/forks","keys_url":"https://api.github.com/repos/stellar/stellar-viewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stellar/stellar-viewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stellar/stellar-viewer/teams","hooks_url":"https://api.github.com/repos/stellar/stellar-viewer/hooks","issue_events_url":"https://api.github.com/repos/stellar/stellar-viewer/issues/events{/number}","events_url":"https://api.github.com/repos/stellar/stellar-viewer/events","assignees_url":"https://api.github.com/repos/stellar/stellar-viewer/assignees{/user}","branches_url":"https://api.github.com/repos/stellar/stellar-viewer/branches{/branch}","tags_url":"https://api.github.com/repos/stellar/stellar-viewer/tags","blobs_url":"https://api.github.com/repos/stellar/stellar-viewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stellar/stellar-viewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stellar/stellar-viewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/stellar/stellar-viewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stellar/stellar-viewer/statuses/{sha}","languages_url":"https://api.github.com/repos/stellar/stellar-viewer/languages","stargazers_url":"https://api.github.com/repos/stellar/stellar-viewer/stargazers","contributors_url":"https://api.github.com/repos/stellar/stellar-viewer/contributors","subscribers_url":"https://api.github.com/repos/stellar/stellar-viewer/subscribers","subscription_url":"https://api.github.com/repos/stellar/stellar-viewer/subscription","commits_url":"https://api.github.com/repos/stellar/stellar-viewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/stellar/stellar-viewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/stellar/stellar-viewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/stellar/stellar-viewer/issues/comments/{number}","contents_url":"https://api.github.com/repos/stellar/stellar-viewer/contents/{+path}","compare_url":"https://api.github.com/repos/stellar/stellar-viewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stellar/stellar-viewer/merges","archive_url":"https://api.github.com/repos/stellar/stellar-viewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stellar/stellar-viewer/downloads","issues_url":"https://api.github.com/repos/stellar/stellar-viewer/issues{/number}","pulls_url":"https://api.github.com/repos/stellar/stellar-viewer/pulls{/number}","milestones_url":"https://api.github.com/repos/stellar/stellar-viewer/milestones{/number}","notifications_url":"https://api.github.com/repos/stellar/stellar-viewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stellar/stellar-viewer/labels{/name}","releases_url":"https://api.github.com/repos/stellar/stellar-viewer/releases{/id}","created_at":"2014-07-30T23:58:37Z","updated_at":"2014-08-20T12:51:49Z","pushed_at":"2014-08-20T23:23:45Z","git_url":"git://github.com/stellar/stellar-viewer.git","ssh_url":"git@github.com:stellar/stellar-viewer.git","clone_url":"https://github.com/stellar/stellar-viewer.git","svn_url":"https://github.com/stellar/stellar-viewer","homepage":null,"size":311,"stargazers_count":27,"watchers_count":27,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":7,"mirror_url":null,"open_issues_count":3,"forks":7,"open_issues":3,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9"},"html":{"href":"https://github.com/stellar/stellar-viewer/pull/9"},"issue":{"href":"https://api.github.com/repos/stellar/stellar-viewer/issues/9"},"comments":{"href":"https://api.github.com/repos/stellar/stellar-viewer/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/stellar/stellar-viewer/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/stellar/stellar-viewer/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/stellar/stellar-viewer/statuses/bd929e2b1bd762ffb48aa638c8260bf4fac3e28f"}}}}