{"action":"created","comment":{"url":"https://api.github.com/repos/mitodl/micromasters/pulls/comments/62089154","id":62089154,"diff_hunk":"@@ -9,27 +17,49 @@ import {\n   clearProfile,\n   fetchDashboard,\n   clearDashboard,\n+  clearUI,\n+  updateDialogText,\n+  updateDialogTitle,\n+  setDialogVisibility,\n } from '../actions/index';\n+import { profileComplete } from '../util/util';\n \n const TERMS_OF_SERVICE_REGEX = /\\/terms_of_service\\/?/;\n+const PROFLE_REGEX = /^\\/profile\\/?[a-z]?/;","path":"static/js/containers/App.js","position":27,"original_position":27,"commit_id":"179da8655bb569162d70ee9cd14f90473d07e1d3","original_commit_id":"179da8655bb569162d70ee9cd14f90473d07e1d3","user":{"login":"aliceriot","id":6207644,"avatar_url":"https://avatars.githubusercontent.com/u/6207644?v=3","gravatar_id":"","url":"https://api.github.com/users/aliceriot","html_url":"https://github.com/aliceriot","followers_url":"https://api.github.com/users/aliceriot/followers","following_url":"https://api.github.com/users/aliceriot/following{/other_user}","gists_url":"https://api.github.com/users/aliceriot/gists{/gist_id}","starred_url":"https://api.github.com/users/aliceriot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliceriot/subscriptions","organizations_url":"https://api.github.com/users/aliceriot/orgs","repos_url":"https://api.github.com/users/aliceriot/repos","events_url":"https://api.github.com/users/aliceriot/events{/privacy}","received_events_url":"https://api.github.com/users/aliceriot/received_events","type":"User","site_admin":false},"body":"is the regex pattern insufficient? I'm kind of bad at regex, haha","created_at":"2016-05-04T18:23:20Z","updated_at":"2016-05-04T18:23:20Z","html_url":"https://github.com/mitodl/micromasters/pull/271#discussion_r62089154","pull_request_url":"https://api.github.com/repos/mitodl/micromasters/pulls/271","_links":{"self":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/comments/62089154"},"html":{"href":"https://github.com/mitodl/micromasters/pull/271#discussion_r62089154"},"pull_request":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/271"}}},"pull_request":{"url":"https://api.github.com/repos/mitodl/micromasters/pulls/271","id":68900199,"html_url":"https://github.com/mitodl/micromasters/pull/271","diff_url":"https://github.com/mitodl/micromasters/pull/271.diff","patch_url":"https://github.com/mitodl/micromasters/pull/271.patch","issue_url":"https://api.github.com/repos/mitodl/micromasters/issues/271","number":271,"state":"open","locked":false,"title":"Added check for profile completeness before visiting dashboard","user":{"login":"aliceriot","id":6207644,"avatar_url":"https://avatars.githubusercontent.com/u/6207644?v=3","gravatar_id":"","url":"https://api.github.com/users/aliceriot","html_url":"https://github.com/aliceriot","followers_url":"https://api.github.com/users/aliceriot/followers","following_url":"https://api.github.com/users/aliceriot/following{/other_user}","gists_url":"https://api.github.com/users/aliceriot/gists{/gist_id}","starred_url":"https://api.github.com/users/aliceriot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliceriot/subscriptions","organizations_url":"https://api.github.com/users/aliceriot/orgs","repos_url":"https://api.github.com/users/aliceriot/repos","events_url":"https://api.github.com/users/aliceriot/events{/privacy}","received_events_url":"https://api.github.com/users/aliceriot/received_events","type":"User","site_admin":false},"body":"#### What are the relevant tickets?\r\n\r\ncloses #227 \r\n\r\n#### What's this PR do?\r\n\r\nThis makes it so that users are directed to fill out unfilled portions of their profile before they can interact with the rest of the dashboard.\r\n\r\nThere's a utility function (`profileComplete`) defined in `util.js`. This returns `true` if a profile is complete, and else it returns an object with messages about what it is incomplete (in general).\r\n\r\nWe also have a function to check completion (in `containers/App.js`) which runs on `componentDidMount` and `componentDidUpdate`, and it follows this logic:\r\n\r\n```\r\nif (\r\n  good profile &&\r\n  already did TOS &&\r\n  not already in /profile && \r\n  profile isn't complete\r\n) {\r\n  // do some stuff\r\n}\r\n```\r\n\r\nso it plays nicely with the TOS page, if a user has both an incomplete profile and has not yet agreed to the terms of service they will be redirected first to the TOS page, and then after agreeing to that they will be redirected to the profile page.\r\n\r\nThe `profileComplete` utility function returns something that looks like this:\r\n\r\n```\r\n{\r\n  url: \"/profile/personal\",\r\n  title: \"Personal Info\",\r\n  text: \"Please complete personal info\"\r\n}\r\n```\r\n\r\nwhere the `url` is where we want to redirect, and the `title` and `text` fields are used to show the user a dialog box. I added a few new actions and a new reducer to handle this (which should be useful in a more general sense for other dialog boxes we might want to show).\r\n\r\nReturning the url here means that we can first check the `personal` tab, and if that isn't valid redirect there, then go on to check the professional tab, etc. \r\n\r\n#### Where should the reviewer start?\r\n\r\nI guess with the new reducers / redux stuff changes - this is what I feel least confident about (is `ui` the right name for a top-level key? what would be better?).\r\n\r\n#### How should this be manually tested?\r\n\r\nTry interacting with it in a couple of different ways. If a field is incomplete in the profile it should be redirecting there in all circumstances (i.e. you shouldn't be able to click away from the profile). It shouldn't redirect to the profile if the user hasn't yet accepted the ToS, however.\r\n\r\n#### Any background context you want to provide?\r\n\r\n#### Screenshots (if appropriate)\r\n\r\n#### What GIF best describes this PR or how it makes you feel?\r\n\r\n","created_at":"2016-05-04T17:26:34Z","updated_at":"2016-05-04T18:23:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9019ea440480e8a242ffc83376adafdecef904fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mitodl/micromasters/pulls/271/commits","review_comments_url":"https://api.github.com/repos/mitodl/micromasters/pulls/271/comments","review_comment_url":"https://api.github.com/repos/mitodl/micromasters/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mitodl/micromasters/issues/271/comments","statuses_url":"https://api.github.com/repos/mitodl/micromasters/statuses/179da8655bb569162d70ee9cd14f90473d07e1d3","head":{"label":"mitodl:ap/complete-profile","ref":"ap/complete-profile","sha":"179da8655bb569162d70ee9cd14f90473d07e1d3","user":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":52919185,"name":"micromasters","full_name":"mitodl/micromasters","owner":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/micromasters","description":"Portal for learners and course teams to access MITx micromasters programs: https://goo.gl/tsUTSO","fork":false,"url":"https://api.github.com/repos/mitodl/micromasters","forks_url":"https://api.github.com/repos/mitodl/micromasters/forks","keys_url":"https://api.github.com/repos/mitodl/micromasters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/micromasters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/micromasters/teams","hooks_url":"https://api.github.com/repos/mitodl/micromasters/hooks","issue_events_url":"https://api.github.com/repos/mitodl/micromasters/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/micromasters/events","assignees_url":"https://api.github.com/repos/mitodl/micromasters/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/micromasters/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/micromasters/tags","blobs_url":"https://api.github.com/repos/mitodl/micromasters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/micromasters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/micromasters/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/micromasters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/micromasters/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/micromasters/languages","stargazers_url":"https://api.github.com/repos/mitodl/micromasters/stargazers","contributors_url":"https://api.github.com/repos/mitodl/micromasters/contributors","subscribers_url":"https://api.github.com/repos/mitodl/micromasters/subscribers","subscription_url":"https://api.github.com/repos/mitodl/micromasters/subscription","commits_url":"https://api.github.com/repos/mitodl/micromasters/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/micromasters/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/micromasters/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/micromasters/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/micromasters/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/micromasters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/micromasters/merges","archive_url":"https://api.github.com/repos/mitodl/micromasters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/micromasters/downloads","issues_url":"https://api.github.com/repos/mitodl/micromasters/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/micromasters/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/micromasters/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/micromasters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/micromasters/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/micromasters/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/micromasters/deployments","created_at":"2016-03-01T23:53:17Z","updated_at":"2016-05-03T18:30:32Z","pushed_at":"2016-05-04T18:05:55Z","git_url":"git://github.com/mitodl/micromasters.git","ssh_url":"git@github.com:mitodl/micromasters.git","clone_url":"https://github.com/mitodl/micromasters.git","svn_url":"https://github.com/mitodl/micromasters","homepage":"","size":9653,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":66,"forks":0,"open_issues":66,"watchers":2,"default_branch":"master"}},"base":{"label":"mitodl:master","ref":"master","sha":"bce03f295d4f88abea9ec959b32cacd074cddb32","user":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":52919185,"name":"micromasters","full_name":"mitodl/micromasters","owner":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/micromasters","description":"Portal for learners and course teams to access MITx micromasters programs: https://goo.gl/tsUTSO","fork":false,"url":"https://api.github.com/repos/mitodl/micromasters","forks_url":"https://api.github.com/repos/mitodl/micromasters/forks","keys_url":"https://api.github.com/repos/mitodl/micromasters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/micromasters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/micromasters/teams","hooks_url":"https://api.github.com/repos/mitodl/micromasters/hooks","issue_events_url":"https://api.github.com/repos/mitodl/micromasters/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/micromasters/events","assignees_url":"https://api.github.com/repos/mitodl/micromasters/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/micromasters/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/micromasters/tags","blobs_url":"https://api.github.com/repos/mitodl/micromasters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/micromasters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/micromasters/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/micromasters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/micromasters/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/micromasters/languages","stargazers_url":"https://api.github.com/repos/mitodl/micromasters/stargazers","contributors_url":"https://api.github.com/repos/mitodl/micromasters/contributors","subscribers_url":"https://api.github.com/repos/mitodl/micromasters/subscribers","subscription_url":"https://api.github.com/repos/mitodl/micromasters/subscription","commits_url":"https://api.github.com/repos/mitodl/micromasters/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/micromasters/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/micromasters/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/micromasters/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/micromasters/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/micromasters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/micromasters/merges","archive_url":"https://api.github.com/repos/mitodl/micromasters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/micromasters/downloads","issues_url":"https://api.github.com/repos/mitodl/micromasters/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/micromasters/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/micromasters/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/micromasters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/micromasters/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/micromasters/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/micromasters/deployments","created_at":"2016-03-01T23:53:17Z","updated_at":"2016-05-03T18:30:32Z","pushed_at":"2016-05-04T18:05:55Z","git_url":"git://github.com/mitodl/micromasters.git","ssh_url":"git@github.com:mitodl/micromasters.git","clone_url":"https://github.com/mitodl/micromasters.git","svn_url":"https://github.com/mitodl/micromasters","homepage":"","size":9653,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":66,"forks":0,"open_issues":66,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/271"},"html":{"href":"https://github.com/mitodl/micromasters/pull/271"},"issue":{"href":"https://api.github.com/repos/mitodl/micromasters/issues/271"},"comments":{"href":"https://api.github.com/repos/mitodl/micromasters/issues/271/comments"},"review_comments":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/271/comments"},"review_comment":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/271/commits"},"statuses":{"href":"https://api.github.com/repos/mitodl/micromasters/statuses/179da8655bb569162d70ee9cd14f90473d07e1d3"}}}}