Skip to content

Commit

Permalink
Enable logged out for /me/account/closed (#97201)
Browse files Browse the repository at this point in the history
* Enable logged out for /me/account/closed

* add explanation comment
  • Loading branch information
candy02058912 authored Dec 8, 2024
1 parent 7249149 commit 814570e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/controller/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ export const redirectInvalidLanguage = ( context, next ) => {

export function redirectLoggedOut( context, next ) {
const state = context.store.getState();
// Allow logged-out users to access account deleted page for self-restore.
// This is an exception because /me should not allow enableLoggedOut.
if ( context.pathname === '/me/account/closed' ) {
return next();
}

if ( isUserLoggedIn( state ) ) {
next();
Expand Down
3 changes: 3 additions & 0 deletions client/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const sections = [
},
{
name: 'account-close',
// /me/account/closed enables account restoration for logged-out users
// Parent route is private so enableLoggedOut flag won't work here
// Redirection is handled in redirectLoggedOut
paths: [ '/me/account/close', '/me/account/closed' ],
module: 'calypso/me/account-close',
group: 'me',
Expand Down

0 comments on commit 814570e

Please sign in to comment.