{"action":"created","comment":{"url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/comments/26014165","id":26014165,"diff_hunk":"@@ -1,19 +1,52 @@\n import React from 'react';\n-import Navbar from './navbar';\n+import Reflux from 'reflux';\n+import Check from 'check-types';\n import { Grid, Col } from 'react-bootstrap';\n-import { RouteHandler } from 'react-router';\n+import { State, Navigation } from 'react-router';\n+import RouteHandler from 'react-router/modules/mixins/RouteHandler';\n+\n+import Navbar from './navbar';\n+import AuthorStore from '../stores/author';\n+import AuthorActions from '../actions/author';\n \n // This layout is used by React-Router to layout the base container of the app.\n // We shouldn't really be putting anything here other than the Navbar.\n export default React.createClass({\n \n+  mixins: [Reflux.listenTo(AuthorStore, \"checkAuthResult\"), State, Navigation, RouteHandler],\n+\n+  getInitialState: function() {\n+    return {\n+      currentAuthor: {}\n+    };\n+  },\n+\n+  checkAuthResult: function(state) {\n+    // on successful login, set logged in state and transition to base timeline\n+    if (Check.object(state.currentAuthor)) {\n+      this.setState({currentAuthor: state.currentAuthor});\n+      this.transitionTo('timeline');\n+    // otherwise ensure the user is at the login view if not already\n+    } else if(!this.isActive('login')) {\n+      this.transitionTo('login');\n+    }\n+  },\n+\n+  // As soon as our base layout is ready, figure out if the user is logged in\n+  componentDidMount: function () {\n+    AuthorActions.checkAuth();\n+  },\n+\n   render: function() {\n+\n+    // we do this so we can pass essentially a global prop into the app in the\n+    // form of the currently logged in user\n     return (\n       <Grid fluid={true}>\n-        <Navbar />\n+        <Navbar author={this.state.currentAuthor} />\n         <Grid>\n           <Col md={8} mdOffset={2}>\n-            <RouteHandler />\n+            <AppHandler currentAuthor={this.state.currentAuthor} />","path":"app/scripts/components/layout.jsx","position":53,"original_position":53,"commit_id":"ef37beb63eb313be85969562e08b3c2193fad294","original_commit_id":"ef37beb63eb313be85969562e08b3c2193fad294","user":{"login":"derekdowling","id":613964,"avatar_url":"https://avatars.githubusercontent.com/u/613964?v=3","gravatar_id":"","url":"https://api.github.com/users/derekdowling","html_url":"https://github.com/derekdowling","followers_url":"https://api.github.com/users/derekdowling/followers","following_url":"https://api.github.com/users/derekdowling/following{/other_user}","gists_url":"https://api.github.com/users/derekdowling/gists{/gist_id}","starred_url":"https://api.github.com/users/derekdowling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekdowling/subscriptions","organizations_url":"https://api.github.com/users/derekdowling/orgs","repos_url":"https://api.github.com/users/derekdowling/repos","events_url":"https://api.github.com/users/derekdowling/events{/privacy}","received_events_url":"https://api.github.com/users/derekdowling/received_events","type":"User","site_admin":false},"body":"@KarimBaaba if I get this working, then we don't need to do componentDidMount everywhere to get the current user and we don't need to do upstream calls to the AuthorStore to get it either.","created_at":"2015-03-09T03:42:02Z","updated_at":"2015-03-09T03:42:02Z","html_url":"https://github.com/CMPUT404/socialdistribution/pull/76#discussion_r26014165","pull_request_url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/comments/26014165"},"html":{"href":"https://github.com/CMPUT404/socialdistribution/pull/76#discussion_r26014165"},"pull_request":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76","id":30734428,"html_url":"https://github.com/CMPUT404/socialdistribution/pull/76","diff_url":"https://github.com/CMPUT404/socialdistribution/pull/76.diff","patch_url":"https://github.com/CMPUT404/socialdistribution/pull/76.patch","issue_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/76","number":76,"state":"open","locked":false,"title":"Profile bio","user":{"login":"derekdowling","id":613964,"avatar_url":"https://avatars.githubusercontent.com/u/613964?v=3","gravatar_id":"","url":"https://api.github.com/users/derekdowling","html_url":"https://github.com/derekdowling","followers_url":"https://api.github.com/users/derekdowling/followers","following_url":"https://api.github.com/users/derekdowling/following{/other_user}","gists_url":"https://api.github.com/users/derekdowling/gists{/gist_id}","starred_url":"https://api.github.com/users/derekdowling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekdowling/subscriptions","organizations_url":"https://api.github.com/users/derekdowling/orgs","repos_url":"https://api.github.com/users/derekdowling/repos","events_url":"https://api.github.com/users/derekdowling/events{/privacy}","received_events_url":"https://api.github.com/users/derekdowling/received_events","type":"User","site_admin":false},"body":"Work in progress.","created_at":"2015-03-09T03:41:08Z","updated_at":"2015-03-09T03:42:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c28b228e11257f86636c8f5ef4805fc0ae91a245","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76/commits","review_comments_url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76/comments","review_comment_url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/76/comments","statuses_url":"https://api.github.com/repos/CMPUT404/socialdistribution/statuses/ef37beb63eb313be85969562e08b3c2193fad294","head":{"label":"CMPUT404:profile-bio","ref":"profile-bio","sha":"ef37beb63eb313be85969562e08b3c2193fad294","user":{"login":"CMPUT404","id":10713091,"avatar_url":"https://avatars.githubusercontent.com/u/10713091?v=3","gravatar_id":"","url":"https://api.github.com/users/CMPUT404","html_url":"https://github.com/CMPUT404","followers_url":"https://api.github.com/users/CMPUT404/followers","following_url":"https://api.github.com/users/CMPUT404/following{/other_user}","gists_url":"https://api.github.com/users/CMPUT404/gists{/gist_id}","starred_url":"https://api.github.com/users/CMPUT404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CMPUT404/subscriptions","organizations_url":"https://api.github.com/users/CMPUT404/orgs","repos_url":"https://api.github.com/users/CMPUT404/repos","events_url":"https://api.github.com/users/CMPUT404/events{/privacy}","received_events_url":"https://api.github.com/users/CMPUT404/received_events","type":"Organization","site_admin":false},"repo":{"id":29875255,"name":"socialdistribution","full_name":"CMPUT404/socialdistribution","owner":{"login":"CMPUT404","id":10713091,"avatar_url":"https://avatars.githubusercontent.com/u/10713091?v=3","gravatar_id":"","url":"https://api.github.com/users/CMPUT404","html_url":"https://github.com/CMPUT404","followers_url":"https://api.github.com/users/CMPUT404/followers","following_url":"https://api.github.com/users/CMPUT404/following{/other_user}","gists_url":"https://api.github.com/users/CMPUT404/gists{/gist_id}","starred_url":"https://api.github.com/users/CMPUT404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CMPUT404/subscriptions","organizations_url":"https://api.github.com/users/CMPUT404/orgs","repos_url":"https://api.github.com/users/CMPUT404/repos","events_url":"https://api.github.com/users/CMPUT404/events{/privacy}","received_events_url":"https://api.github.com/users/CMPUT404/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CMPUT404/socialdistribution","description":"A distributed social network","fork":false,"url":"https://api.github.com/repos/CMPUT404/socialdistribution","forks_url":"https://api.github.com/repos/CMPUT404/socialdistribution/forks","keys_url":"https://api.github.com/repos/CMPUT404/socialdistribution/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CMPUT404/socialdistribution/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CMPUT404/socialdistribution/teams","hooks_url":"https://api.github.com/repos/CMPUT404/socialdistribution/hooks","issue_events_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/events{/number}","events_url":"https://api.github.com/repos/CMPUT404/socialdistribution/events","assignees_url":"https://api.github.com/repos/CMPUT404/socialdistribution/assignees{/user}","branches_url":"https://api.github.com/repos/CMPUT404/socialdistribution/branches{/branch}","tags_url":"https://api.github.com/repos/CMPUT404/socialdistribution/tags","blobs_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/refs{/sha}","trees_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CMPUT404/socialdistribution/statuses/{sha}","languages_url":"https://api.github.com/repos/CMPUT404/socialdistribution/languages","stargazers_url":"https://api.github.com/repos/CMPUT404/socialdistribution/stargazers","contributors_url":"https://api.github.com/repos/CMPUT404/socialdistribution/contributors","subscribers_url":"https://api.github.com/repos/CMPUT404/socialdistribution/subscribers","subscription_url":"https://api.github.com/repos/CMPUT404/socialdistribution/subscription","commits_url":"https://api.github.com/repos/CMPUT404/socialdistribution/commits{/sha}","git_commits_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/commits{/sha}","comments_url":"https://api.github.com/repos/CMPUT404/socialdistribution/comments{/number}","issue_comment_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/comments{/number}","contents_url":"https://api.github.com/repos/CMPUT404/socialdistribution/contents/{+path}","compare_url":"https://api.github.com/repos/CMPUT404/socialdistribution/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CMPUT404/socialdistribution/merges","archive_url":"https://api.github.com/repos/CMPUT404/socialdistribution/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CMPUT404/socialdistribution/downloads","issues_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues{/number}","pulls_url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls{/number}","milestones_url":"https://api.github.com/repos/CMPUT404/socialdistribution/milestones{/number}","notifications_url":"https://api.github.com/repos/CMPUT404/socialdistribution/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CMPUT404/socialdistribution/labels{/name}","releases_url":"https://api.github.com/repos/CMPUT404/socialdistribution/releases{/id}","created_at":"2015-01-26T18:32:01Z","updated_at":"2015-03-09T01:08:46Z","pushed_at":"2015-03-09T03:40:52Z","git_url":"git://github.com/CMPUT404/socialdistribution.git","ssh_url":"git@github.com:CMPUT404/socialdistribution.git","clone_url":"https://github.com/CMPUT404/socialdistribution.git","svn_url":"https://github.com/CMPUT404/socialdistribution","homepage":null,"size":616,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":54,"forks":0,"open_issues":54,"watchers":0,"default_branch":"master"}},"base":{"label":"CMPUT404:master","ref":"master","sha":"8ac5afef26ded0dca5b92bdb22dd1cf461049a1d","user":{"login":"CMPUT404","id":10713091,"avatar_url":"https://avatars.githubusercontent.com/u/10713091?v=3","gravatar_id":"","url":"https://api.github.com/users/CMPUT404","html_url":"https://github.com/CMPUT404","followers_url":"https://api.github.com/users/CMPUT404/followers","following_url":"https://api.github.com/users/CMPUT404/following{/other_user}","gists_url":"https://api.github.com/users/CMPUT404/gists{/gist_id}","starred_url":"https://api.github.com/users/CMPUT404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CMPUT404/subscriptions","organizations_url":"https://api.github.com/users/CMPUT404/orgs","repos_url":"https://api.github.com/users/CMPUT404/repos","events_url":"https://api.github.com/users/CMPUT404/events{/privacy}","received_events_url":"https://api.github.com/users/CMPUT404/received_events","type":"Organization","site_admin":false},"repo":{"id":29875255,"name":"socialdistribution","full_name":"CMPUT404/socialdistribution","owner":{"login":"CMPUT404","id":10713091,"avatar_url":"https://avatars.githubusercontent.com/u/10713091?v=3","gravatar_id":"","url":"https://api.github.com/users/CMPUT404","html_url":"https://github.com/CMPUT404","followers_url":"https://api.github.com/users/CMPUT404/followers","following_url":"https://api.github.com/users/CMPUT404/following{/other_user}","gists_url":"https://api.github.com/users/CMPUT404/gists{/gist_id}","starred_url":"https://api.github.com/users/CMPUT404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CMPUT404/subscriptions","organizations_url":"https://api.github.com/users/CMPUT404/orgs","repos_url":"https://api.github.com/users/CMPUT404/repos","events_url":"https://api.github.com/users/CMPUT404/events{/privacy}","received_events_url":"https://api.github.com/users/CMPUT404/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CMPUT404/socialdistribution","description":"A distributed social network","fork":false,"url":"https://api.github.com/repos/CMPUT404/socialdistribution","forks_url":"https://api.github.com/repos/CMPUT404/socialdistribution/forks","keys_url":"https://api.github.com/repos/CMPUT404/socialdistribution/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CMPUT404/socialdistribution/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CMPUT404/socialdistribution/teams","hooks_url":"https://api.github.com/repos/CMPUT404/socialdistribution/hooks","issue_events_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/events{/number}","events_url":"https://api.github.com/repos/CMPUT404/socialdistribution/events","assignees_url":"https://api.github.com/repos/CMPUT404/socialdistribution/assignees{/user}","branches_url":"https://api.github.com/repos/CMPUT404/socialdistribution/branches{/branch}","tags_url":"https://api.github.com/repos/CMPUT404/socialdistribution/tags","blobs_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/refs{/sha}","trees_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CMPUT404/socialdistribution/statuses/{sha}","languages_url":"https://api.github.com/repos/CMPUT404/socialdistribution/languages","stargazers_url":"https://api.github.com/repos/CMPUT404/socialdistribution/stargazers","contributors_url":"https://api.github.com/repos/CMPUT404/socialdistribution/contributors","subscribers_url":"https://api.github.com/repos/CMPUT404/socialdistribution/subscribers","subscription_url":"https://api.github.com/repos/CMPUT404/socialdistribution/subscription","commits_url":"https://api.github.com/repos/CMPUT404/socialdistribution/commits{/sha}","git_commits_url":"https://api.github.com/repos/CMPUT404/socialdistribution/git/commits{/sha}","comments_url":"https://api.github.com/repos/CMPUT404/socialdistribution/comments{/number}","issue_comment_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/comments{/number}","contents_url":"https://api.github.com/repos/CMPUT404/socialdistribution/contents/{+path}","compare_url":"https://api.github.com/repos/CMPUT404/socialdistribution/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CMPUT404/socialdistribution/merges","archive_url":"https://api.github.com/repos/CMPUT404/socialdistribution/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CMPUT404/socialdistribution/downloads","issues_url":"https://api.github.com/repos/CMPUT404/socialdistribution/issues{/number}","pulls_url":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls{/number}","milestones_url":"https://api.github.com/repos/CMPUT404/socialdistribution/milestones{/number}","notifications_url":"https://api.github.com/repos/CMPUT404/socialdistribution/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CMPUT404/socialdistribution/labels{/name}","releases_url":"https://api.github.com/repos/CMPUT404/socialdistribution/releases{/id}","created_at":"2015-01-26T18:32:01Z","updated_at":"2015-03-09T01:08:46Z","pushed_at":"2015-03-09T03:40:52Z","git_url":"git://github.com/CMPUT404/socialdistribution.git","ssh_url":"git@github.com:CMPUT404/socialdistribution.git","clone_url":"https://github.com/CMPUT404/socialdistribution.git","svn_url":"https://github.com/CMPUT404/socialdistribution","homepage":null,"size":616,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":54,"forks":0,"open_issues":54,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76"},"html":{"href":"https://github.com/CMPUT404/socialdistribution/pull/76"},"issue":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/76"},"comments":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/CMPUT404/socialdistribution/statuses/ef37beb63eb313be85969562e08b3c2193fad294"}}}}