{"action":"created","comment":{"url":"https://api.github.com/repos/openstax/tutor-js/pulls/comments/77033390","id":77033390,"diff_hunk":"@@ -123,13 +123,16 @@ class ConceptCoachAPI extends EventEmitter2\n       componentModel.channel.emit('close.clicked')\n \n     @close = props.close\n+\n+    # Needs to be added on initialize since opening from a coach path calls\n+    # initialize, and not open.  On will handle multiple logging in and out.\n+    # \n+    # Wait until our logout request has been received and the close\n+    User.channel.on('logout.received', @close)\n+\n     @component = coachWrapped.render(mountNode, props)","path":"coach/src/concept-coach/index.cjsx","position":11,"original_position":11,"commit_id":"54d3b23bb39d5f24733d927115f0ecb99264b56b","original_commit_id":"54d3b23bb39d5f24733d927115f0ecb99264b56b","user":{"login":"nathanstitt","id":79566,"avatar_url":"https://avatars.githubusercontent.com/u/79566?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanstitt","html_url":"https://github.com/nathanstitt","followers_url":"https://api.github.com/users/nathanstitt/followers","following_url":"https://api.github.com/users/nathanstitt/following{/other_user}","gists_url":"https://api.github.com/users/nathanstitt/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanstitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanstitt/subscriptions","organizations_url":"https://api.github.com/users/nathanstitt/orgs","repos_url":"https://api.github.com/users/nathanstitt/repos","events_url":"https://api.github.com/users/nathanstitt/events{/privacy}","received_events_url":"https://api.github.com/users/nathanstitt/received_events","type":"User","site_admin":false},"body":"I seem to remember that at one time we had problems with webview calling initialize being multiple times, which is why we added the `remove()` call on line 112 above.  \r\n\r\nShould we add a `User.channel.off('logout.received', @close) to the `remove` method so they're balanced?","created_at":"2016-08-31T17:29:58Z","updated_at":"2016-08-31T17:29:58Z","html_url":"https://github.com/openstax/tutor-js/pull/1324#discussion_r77033390","pull_request_url":"https://api.github.com/repos/openstax/tutor-js/pulls/1324","_links":{"self":{"href":"https://api.github.com/repos/openstax/tutor-js/pulls/comments/77033390"},"html":{"href":"https://github.com/openstax/tutor-js/pull/1324#discussion_r77033390"},"pull_request":{"href":"https://api.github.com/repos/openstax/tutor-js/pulls/1324"}}},"pull_request":{"url":"https://api.github.com/repos/openstax/tutor-js/pulls/1324","id":83356216,"html_url":"https://github.com/openstax/tutor-js/pull/1324","diff_url":"https://github.com/openstax/tutor-js/pull/1324.diff","patch_url":"https://github.com/openstax/tutor-js/pull/1324.patch","issue_url":"https://api.github.com/repos/openstax/tutor-js/issues/1324","number":1324,"state":"open","locked":false,"title":"listen for logout.received when opening from a coach view route.","user":{"login":"pandafulmanda","id":2483873,"avatar_url":"https://avatars.githubusercontent.com/u/2483873?v=3","gravatar_id":"","url":"https://api.github.com/users/pandafulmanda","html_url":"https://github.com/pandafulmanda","followers_url":"https://api.github.com/users/pandafulmanda/followers","following_url":"https://api.github.com/users/pandafulmanda/following{/other_user}","gists_url":"https://api.github.com/users/pandafulmanda/gists{/gist_id}","starred_url":"https://api.github.com/users/pandafulmanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pandafulmanda/subscriptions","organizations_url":"https://api.github.com/users/pandafulmanda/orgs","repos_url":"https://api.github.com/users/pandafulmanda/repos","events_url":"https://api.github.com/users/pandafulmanda/events{/privacy}","received_events_url":"https://api.github.com/users/pandafulmanda/received_events","type":"User","site_admin":false},"body":"Fixes [logging out from coach does not close coach](https://trello.com/c/OJkEmiFh/22-concept-coach-bug-log-out-doesn-t-work).\r\n\r\nSpecifically, as @nathanstitt found, this happened whenever the webview was loaded with a coach route suffix.  When this happens, the `cc.open` function where we were adding the listeners for `logout.received` does not get called.  This PR moves adding the listeners on `cc.initialized`, which will always get called, regardless of webview loading with or without coach route suffix.","created_at":"2016-08-30T22:06:14Z","updated_at":"2016-08-31T17:29:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"839fd612ab3598420d1e69ce4bae91044a949725","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openstax/tutor-js/pulls/1324/commits","review_comments_url":"https://api.github.com/repos/openstax/tutor-js/pulls/1324/comments","review_comment_url":"https://api.github.com/repos/openstax/tutor-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openstax/tutor-js/issues/1324/comments","statuses_url":"https://api.github.com/repos/openstax/tutor-js/statuses/54d3b23bb39d5f24733d927115f0ecb99264b56b","head":{"label":"openstax:fix/coach/listen-for-logout","ref":"fix/coach/listen-for-logout","sha":"54d3b23bb39d5f24733d927115f0ecb99264b56b","user":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"repo":{"id":24433756,"name":"tutor-js","full_name":"openstax/tutor-js","owner":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openstax/tutor-js","description":":mortar_board: Javascript frontend for openstax tutor","fork":false,"url":"https://api.github.com/repos/openstax/tutor-js","forks_url":"https://api.github.com/repos/openstax/tutor-js/forks","keys_url":"https://api.github.com/repos/openstax/tutor-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openstax/tutor-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openstax/tutor-js/teams","hooks_url":"https://api.github.com/repos/openstax/tutor-js/hooks","issue_events_url":"https://api.github.com/repos/openstax/tutor-js/issues/events{/number}","events_url":"https://api.github.com/repos/openstax/tutor-js/events","assignees_url":"https://api.github.com/repos/openstax/tutor-js/assignees{/user}","branches_url":"https://api.github.com/repos/openstax/tutor-js/branches{/branch}","tags_url":"https://api.github.com/repos/openstax/tutor-js/tags","blobs_url":"https://api.github.com/repos/openstax/tutor-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openstax/tutor-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openstax/tutor-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/openstax/tutor-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openstax/tutor-js/statuses/{sha}","languages_url":"https://api.github.com/repos/openstax/tutor-js/languages","stargazers_url":"https://api.github.com/repos/openstax/tutor-js/stargazers","contributors_url":"https://api.github.com/repos/openstax/tutor-js/contributors","subscribers_url":"https://api.github.com/repos/openstax/tutor-js/subscribers","subscription_url":"https://api.github.com/repos/openstax/tutor-js/subscription","commits_url":"https://api.github.com/repos/openstax/tutor-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/openstax/tutor-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/openstax/tutor-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/openstax/tutor-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/openstax/tutor-js/contents/{+path}","compare_url":"https://api.github.com/repos/openstax/tutor-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openstax/tutor-js/merges","archive_url":"https://api.github.com/repos/openstax/tutor-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openstax/tutor-js/downloads","issues_url":"https://api.github.com/repos/openstax/tutor-js/issues{/number}","pulls_url":"https://api.github.com/repos/openstax/tutor-js/pulls{/number}","milestones_url":"https://api.github.com/repos/openstax/tutor-js/milestones{/number}","notifications_url":"https://api.github.com/repos/openstax/tutor-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openstax/tutor-js/labels{/name}","releases_url":"https://api.github.com/repos/openstax/tutor-js/releases{/id}","deployments_url":"https://api.github.com/repos/openstax/tutor-js/deployments","created_at":"2014-09-24T21:42:26Z","updated_at":"2016-03-09T21:53:06Z","pushed_at":"2016-08-31T15:34:15Z","git_url":"git://github.com/openstax/tutor-js.git","ssh_url":"git@github.com:openstax/tutor-js.git","clone_url":"https://github.com/openstax/tutor-js.git","svn_url":"https://github.com/openstax/tutor-js","homepage":"","size":36788,"stargazers_count":5,"watchers_count":5,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":15,"forks":2,"open_issues":15,"watchers":5,"default_branch":"master"}},"base":{"label":"openstax:master","ref":"master","sha":"64181d841fdd168982075463477fe3761521af6d","user":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"repo":{"id":24433756,"name":"tutor-js","full_name":"openstax/tutor-js","owner":{"login":"openstax","id":3805549,"avatar_url":"https://avatars.githubusercontent.com/u/3805549?v=3","gravatar_id":"","url":"https://api.github.com/users/openstax","html_url":"https://github.com/openstax","followers_url":"https://api.github.com/users/openstax/followers","following_url":"https://api.github.com/users/openstax/following{/other_user}","gists_url":"https://api.github.com/users/openstax/gists{/gist_id}","starred_url":"https://api.github.com/users/openstax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openstax/subscriptions","organizations_url":"https://api.github.com/users/openstax/orgs","repos_url":"https://api.github.com/users/openstax/repos","events_url":"https://api.github.com/users/openstax/events{/privacy}","received_events_url":"https://api.github.com/users/openstax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openstax/tutor-js","description":":mortar_board: Javascript frontend for openstax tutor","fork":false,"url":"https://api.github.com/repos/openstax/tutor-js","forks_url":"https://api.github.com/repos/openstax/tutor-js/forks","keys_url":"https://api.github.com/repos/openstax/tutor-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openstax/tutor-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openstax/tutor-js/teams","hooks_url":"https://api.github.com/repos/openstax/tutor-js/hooks","issue_events_url":"https://api.github.com/repos/openstax/tutor-js/issues/events{/number}","events_url":"https://api.github.com/repos/openstax/tutor-js/events","assignees_url":"https://api.github.com/repos/openstax/tutor-js/assignees{/user}","branches_url":"https://api.github.com/repos/openstax/tutor-js/branches{/branch}","tags_url":"https://api.github.com/repos/openstax/tutor-js/tags","blobs_url":"https://api.github.com/repos/openstax/tutor-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openstax/tutor-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openstax/tutor-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/openstax/tutor-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openstax/tutor-js/statuses/{sha}","languages_url":"https://api.github.com/repos/openstax/tutor-js/languages","stargazers_url":"https://api.github.com/repos/openstax/tutor-js/stargazers","contributors_url":"https://api.github.com/repos/openstax/tutor-js/contributors","subscribers_url":"https://api.github.com/repos/openstax/tutor-js/subscribers","subscription_url":"https://api.github.com/repos/openstax/tutor-js/subscription","commits_url":"https://api.github.com/repos/openstax/tutor-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/openstax/tutor-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/openstax/tutor-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/openstax/tutor-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/openstax/tutor-js/contents/{+path}","compare_url":"https://api.github.com/repos/openstax/tutor-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openstax/tutor-js/merges","archive_url":"https://api.github.com/repos/openstax/tutor-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openstax/tutor-js/downloads","issues_url":"https://api.github.com/repos/openstax/tutor-js/issues{/number}","pulls_url":"https://api.github.com/repos/openstax/tutor-js/pulls{/number}","milestones_url":"https://api.github.com/repos/openstax/tutor-js/milestones{/number}","notifications_url":"https://api.github.com/repos/openstax/tutor-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openstax/tutor-js/labels{/name}","releases_url":"https://api.github.com/repos/openstax/tutor-js/releases{/id}","deployments_url":"https://api.github.com/repos/openstax/tutor-js/deployments","created_at":"2014-09-24T21:42:26Z","updated_at":"2016-03-09T21:53:06Z","pushed_at":"2016-08-31T15:34:15Z","git_url":"git://github.com/openstax/tutor-js.git","ssh_url":"git@github.com:openstax/tutor-js.git","clone_url":"https://github.com/openstax/tutor-js.git","svn_url":"https://github.com/openstax/tutor-js","homepage":"","size":36788,"stargazers_count":5,"watchers_count":5,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":15,"forks":2,"open_issues":15,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openstax/tutor-js/pulls/1324"},"html":{"href":"https://github.com/openstax/tutor-js/pull/1324"},"issue":{"href":"https://api.github.com/repos/openstax/tutor-js/issues/1324"},"comments":{"href":"https://api.github.com/repos/openstax/tutor-js/issues/1324/comments"},"review_comments":{"href":"https://api.github.com/repos/openstax/tutor-js/pulls/1324/comments"},"review_comment":{"href":"https://api.github.com/repos/openstax/tutor-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openstax/tutor-js/pulls/1324/commits"},"statuses":{"href":"https://api.github.com/repos/openstax/tutor-js/statuses/54d3b23bb39d5f24733d927115f0ecb99264b56b"}}}}
{"actor":{"display_login":"nathanstitt"}}