Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Turn the site subscription switch on after a WordPress.com sign-in when the account already subscribes.
3 changes: 3 additions & 0 deletions projects/packages/comments/src/modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ export const Dialog = ( { internals }: { internals: ElementInternals } ) => {
}

if ( formSettings.subscriptions.length ) {
if ( result.subscribedBlog ) {
setSubscribed( current => ( { ...current, subscribe_blog: true } ) );
}
setStep( 'subscribe' );
return;
}
Expand Down
1 change: 1 addition & 0 deletions projects/packages/comments/src/shared/checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const signIn = async (
code: data.code,
name: typeof data.name === 'string' ? data.name : '',
avatar: ( typeof data.avatar === 'string' && data.avatar ) || identity.defaultAvatar,
subscribedBlog: data.subscribed_blog === true,
} );
}

Expand Down
4 changes: 3 additions & 1 deletion projects/packages/comments/src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export type Passport = {
};

export type CheckpointResult =
( Passport & { code: string } ) | { error: string } | { cancelled: true };
| ( Passport & { code: string; subscribedBlog: boolean } )
| { error: string }
| { cancelled: true };

/**
* Who is commenting. A popup sign-in's `code` is set until the comment posts and
Expand Down
Loading