Automattic / Automattic/jetpack
My Jetpack: Allow redirect to arbitrary page after Jetpack connection
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
The ConnectionScreen component allows the use of a `returnTo` parameter to redirect the user after connection:
https://github.com/Automattic/jetpack/blob/7d9b325e165616e2d7ef0ed6aa7dbd6b2e6610cd/projects/packages/my-jetpack/_inc/components/connection-screen/index.jsx#LL49C2-L49C50
But that is hardcoded to only allow pages within My Jetpack: https://github.com/Automattic/jetpack/blob/7d9b325e165616e2d7ef0ed6aa7dbd6b2e6610cd/projects/packages/my-jetpack/_inc/components/connection-screen/index.jsx#L117
When establishing a connection from a prompt in the block editor, the user might expect to be redirected back to the block editor, which is not possible with this limitation.
ref p1685127123551239/1685125754.087739-slack-C054LN8RNVA
Contributor guide
Research direction
Start in projects/packages/my-jetpack/_inc/components/connection-screen/index.jsx, reading the returnTo parameter and the restriction around line 117. Check how connection is initiated from the block editor, then update the behavior so the post-connection redirect can return there or another requested page; done means the redirect is no longer limited to My Jetpack pages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100