Skip to content

Commit 80675dc

Browse files
authored
Reader: reader and account flows set Reader as the user's default landing page (#99379)
* When reader flow is complete set Reader as users landing page * Set Reader as home on start/account/user-social
1 parent 7ae2af7 commit 80675dc

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

client/signup/config/flows-pure.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { isEnabled } from '@automattic/calypso-config';
22
import { HOSTING_LP_FLOW, ONBOARDING_FLOW, ONBOARDING_GUIDED_FLOW } from '@automattic/onboarding';
33
import { translate } from 'i18n-calypso';
4+
import { savePreference } from 'calypso/state/preferences/actions';
5+
import { READER_AS_LANDING_PAGE_PREFERENCE } from 'calypso/state/sites/selectors/has-reader-as-landing-page';
46

57
const noop = () => {};
68

@@ -90,6 +92,14 @@ export function generateFlows( {
9092
providesDependenciesInQuery: [ 'toStepper' ],
9193
optionalDependenciesInQuery: [ 'toStepper' ],
9294
hideProgressIndicator: true,
95+
postCompleteCallback: async ( { dispatch } ) => {
96+
dispatch(
97+
savePreference( READER_AS_LANDING_PAGE_PREFERENCE, {
98+
useReaderAsLandingPage: true,
99+
updatedAt: Date.now(),
100+
} )
101+
);
102+
},
93103
},
94104
{
95105
name: 'business',
@@ -372,6 +382,14 @@ export function generateFlows( {
372382
lastModified: '2025-01-28',
373383
showRecaptcha: true,
374384
hideProgressIndicator: true,
385+
postCompleteCallback: async ( { dispatch } ) => {
386+
dispatch(
387+
savePreference( READER_AS_LANDING_PAGE_PREFERENCE, {
388+
useReaderAsLandingPage: true,
389+
updatedAt: Date.now(),
390+
} )
391+
);
392+
},
375393
},
376394
{
377395
name: 'crowdsignal',

client/signup/main.jsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ class Signup extends Component {
395395

396396
if ( flow.postCompleteCallback ) {
397397
const siteId = dependencies && dependencies.siteId;
398-
await flow.postCompleteCallback( { siteId, flowName: this.props.flowName } );
398+
await flow.postCompleteCallback( {
399+
siteId,
400+
flowName: this.props.flowName,
401+
dispatch: this.props.dispatch,
402+
} );
399403
}
400404
};
401405

@@ -631,7 +635,7 @@ class Signup extends Component {
631635
dependencies.oauth2_client_id && ! progress?.[ 'oauth2-user' ]?.service; // service is set for social signup (e.g. Google, Apple)
632636
// If the user is not logged in, we need to log them in first.
633637
// And if it's regular oauth client signup, we perform the oauth login because the WPCC user creation code automatically logs the user in.
634-
// Theres no need to turn the bearer token into a cookie. If we log user in again, it will cause an activation error.
638+
// There's no need to turn the bearer token into a cookie. If we log user in again, it will cause an activation error.
635639
// However, we need to skip this to perform a regular login for social sign in.
636640
if ( ! userIsLoggedIn && ( config.isEnabled( 'oauth' ) || isRegularOauth2ClientSignup ) ) {
637641
debug( `Handling oauth login` );
@@ -1012,9 +1016,10 @@ export default connect(
10121016
hostingFlow,
10131017
};
10141018
},
1015-
{
1019+
( dispatch ) => ( {
1020+
dispatch,
10161021
submitSignupStep,
10171022
removeStep,
10181023
addStep,
1019-
}
1024+
} )
10201025
)( Signup );

0 commit comments

Comments
 (0)