{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/28385","repository_url":"https://api.github.com/repos/Automattic/wp-calypso","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/28385/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/28385/comments","events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/28385/events","html_url":"https://github.com/Automattic/wp-calypso/pull/28385","id":378719894,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MzU1NjQ3","number":28385,"title":"Gutenberg: Prevent redirect loop on opt-in and close","user":{"login":"Copons","id":2070010,"node_id":"MDQ6VXNlcjIwNzAwMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2070010?v=4","gravatar_id":"","url":"https://api.github.com/users/Copons","html_url":"https://github.com/Copons","followers_url":"https://api.github.com/users/Copons/followers","following_url":"https://api.github.com/users/Copons/following{/other_user}","gists_url":"https://api.github.com/users/Copons/gists{/gist_id}","starred_url":"https://api.github.com/users/Copons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Copons/subscriptions","organizations_url":"https://api.github.com/users/Copons/orgs","repos_url":"https://api.github.com/users/Copons/repos","events_url":"https://api.github.com/users/Copons/events{/privacy}","received_events_url":"https://api.github.com/users/Copons/received_events","type":"User","site_admin":false},"labels":[{"id":967391996,"node_id":"MDU6TGFiZWw5NjczOTE5OTY=","url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Goal]%20Gutenberg","name":"[Goal] Gutenberg","color":"97f4d2","default":false},{"id":285010018,"node_id":"MDU6TGFiZWwyODUwMTAwMTg=","url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Status]%20Needs%20Review","name":"[Status] Needs Review","color":"fbca04","default":false},{"id":285009975,"node_id":"MDU6TGFiZWwyODUwMDk5NzU=","url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Type]%20Bug","name":"[Type] Bug","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":{"login":"Copons","id":2070010,"node_id":"MDQ6VXNlcjIwNzAwMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2070010?v=4","gravatar_id":"","url":"https://api.github.com/users/Copons","html_url":"https://github.com/Copons","followers_url":"https://api.github.com/users/Copons/followers","following_url":"https://api.github.com/users/Copons/following{/other_user}","gists_url":"https://api.github.com/users/Copons/gists{/gist_id}","starred_url":"https://api.github.com/users/Copons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Copons/subscriptions","organizations_url":"https://api.github.com/users/Copons/orgs","repos_url":"https://api.github.com/users/Copons/repos","events_url":"https://api.github.com/users/Copons/events{/privacy}","received_events_url":"https://api.github.com/users/Copons/received_events","type":"User","site_admin":false},"assignees":[{"login":"Copons","id":2070010,"node_id":"MDQ6VXNlcjIwNzAwMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2070010?v=4","gravatar_id":"","url":"https://api.github.com/users/Copons","html_url":"https://github.com/Copons","followers_url":"https://api.github.com/users/Copons/followers","following_url":"https://api.github.com/users/Copons/following{/other_user}","gists_url":"https://api.github.com/users/Copons/gists{/gist_id}","starred_url":"https://api.github.com/users/Copons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Copons/subscriptions","organizations_url":"https://api.github.com/users/Copons/orgs","repos_url":"https://api.github.com/users/Copons/repos","events_url":"https://api.github.com/users/Copons/events{/privacy}","received_events_url":"https://api.github.com/users/Copons/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-11-08T12:56:57Z","updated_at":"2018-11-08T12:56:59Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/28385","html_url":"https://github.com/Automattic/wp-calypso/pull/28385","diff_url":"https://github.com/Automattic/wp-calypso/pull/28385.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/28385.patch"},"body":"Classic and Gutenberg editors both have a Close button that attempts to redirect to the last non-editor path.\r\nCurrently the logic is slightly different between the two:\r\n- Classic matches only `/post` paths.\r\n- Gutenberg matches only `/gutenberg/post` paths.\r\n\r\nThough, when opting-in to Gutenberg, the route history is something like this:\r\n- Start in the posts list, or any other route really: `/posts`\r\n- Open a post editor: `/post`\r\n- Opt in to Gutenberg: `/gutenberg/post`\r\n- Close Gutenberg: the first non-`/gutenberg/post` path is `/post` again and the PostEditor controller will try to redirect to `/gutenberg/post`.\r\n\r\n#### Changes proposed in this Pull Request\r\n\r\n* Update the `lastEditorPath` regex to match both `/post` and `/gutenberg/post` paths.\r\n\r\n#### Testing instructions\r\n\r\nWait for #28383 to merge, and for #28372 as well to test on calypso.live.\r\n\r\n* Open Calypso disabling the `calypsoify/gutenberg` feature flag: http://calypso.localhost:3000/posts/?flags=-calypsoify/gutenberg\r\n* Opt out of gutenberg by entering `dispatch( { type: 'EDITOR_TYPE_SET', siteId: state.ui.selectedSiteId, editor: 'classic' } )` in the browser console.\r\n* Open any non-editor route (such as the posts list).\r\n* Open a post editor and opt in to Gutenberg through the sidebar prompt or the bottom notice.\r\n* After being redirected to the Gutenberg editor, click on the \"Close\" button in the upper-left corner.\r\n* Make sure you are redirected to the last non-editor route (e.g. the posts list).\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments/436984922","html_url":"https://github.com/Automattic/wp-calypso/pull/28385#issuecomment-436984922","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/28385","id":436984922,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjk4NDkyMg==","user":{"login":"matticbot","id":18333116,"node_id":"MDQ6VXNlcjE4MzMzMTE2","avatar_url":"https://avatars2.githubusercontent.com/u/18333116?v=4","gravatar_id":"","url":"https://api.github.com/users/matticbot","html_url":"https://github.com/matticbot","followers_url":"https://api.github.com/users/matticbot/followers","following_url":"https://api.github.com/users/matticbot/following{/other_user}","gists_url":"https://api.github.com/users/matticbot/gists{/gist_id}","starred_url":"https://api.github.com/users/matticbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matticbot/subscriptions","organizations_url":"https://api.github.com/users/matticbot/orgs","repos_url":"https://api.github.com/users/matticbot/repos","events_url":"https://api.github.com/users/matticbot/events{/privacy}","received_events_url":"https://api.github.com/users/matticbot/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T12:56:59Z","updated_at":"2018-11-08T12:56:59Z","author_association":"NONE","body":"Test live: https://calypso.live/?branch=fix/gutenberg-close-button"}}
{"actor":{"display_login":"matticbot"}}