-
Notifications
You must be signed in to change notification settings - Fork 2k
Leave blog: Allow users to leave their blog #102597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~386 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~606 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~3309 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
97e722d
to
0393500
Compare
client/sites/settings/administration/tools/leave-site/leave-site-modal-warning.tsx
Outdated
Show resolved
Hide resolved
); | ||
} | ||
|
||
if ( hasActiveSubscriptions ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? This means that I can never leave a non-Free site, even though I'm not the owner 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wpcom only checks whether the user has the domain subscriptions or not. However, the endpoint also checks the active subscriptions so I assume it should be consistent with it 🤔
The name may not be correct as it should be hasActiveCancelableSubscriptions
. I'll rename it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try this case:
- Create a Premium site.
- Invite a user as non-admin
- Try leaving the site from that user.
In my testing I can't do that; it warns me that I need to cancel the subscription even though I'm not the owner. So basically noone can leave a Premium site
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm… I actually considered this case, but I couldn’t find a reliable way to determine whether the purchases belonged to the current user. I assumed they could only access their own purchases through the endpoint, but that doesn’t seem to be the case. Let me think through how to resolve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be resolved now. The issue was caused by switching to useUserQuery
to get the current user ID — but non-admin users don’t have permission to access that endpoint. As a result, the “Leave site” button stayed disabled because the user ID wasn’t available.
I’ve updated it to use the core WordPress endpoint /wp/v2/users/me
instead, which works for all logged-in users and fixes the permission issue.
Also, regarding the purchases endpoint — it’s only accessible by site admins, so non-admin users wouldn’t have hit this problem. For admin users, I realized the purchases data actually includes a userId
field which I totally missed yesterday... 🙈. With that, I’m now able to get cancelable purchases based on user ID to avoid this case.
client/sites/settings/administration/tools/leave-site/leave-site-modal-form.tsx
Show resolved
Hide resolved
Thanks for the ping. Default looks good ✅ For the other variations, I don't think it quite works to combine the Leave modal with the notice, most of the information is irrelevant until the user meets the relevant conditions. In other words, if the user is unable to leave the site; display a confirmDialog explaining why with cta. When there are two conditions we can show the subscription management one first. ![]() What do you think? |
Sounds good to me! What about the owner who has the subscriptions? Should we just handle those cases one by one? Also, I noticed other places use the term “Manage Purchases” for this kind of situation. Would it be better to align with that wording for consistency? Thanks! |
Yes I think one-by-one is okay.
Absolutely, apologies for that! |
89deabd
to
0419610
Compare
@jameskoster I kept the dialog header visible for users who are either the site owner or have active subscriptions. The reason is that we can’t determine this beforehand — only after the user clicks “Leave site” in the site list. If we still prefer not to show the header, I think it makes sense to hide it in all cases, even for users who can leave the site. Since it looks like we can always use the dialog, what do you think? |
Not a strong opinion but I'd omit the header, or use a different one. I appreciate 'Leave site' echoes the trigger, but I see this dialog more like an interruptive middle-state for explaining why the user cannot leave the site currently. If you think including a header is important I'd probably change it to something like "Unable to leave site". |
Okay, let's remove the header 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the /sites list, leaving a site does not automatically remove it from the table, which could be confusing 🤔
iXhkJT.mp4
client/sites/settings/administration/tools/leave-site/leave-site-modal-form.tsx
Show resolved
Hide resolved
d76cc6d
to
0b32095
Compare
Weirdly, it should be addressed by 7011ca2 as well and I can see the site has been removed from the table after leaving 🤔 Screen.Recording.2025-04-18.at.2.16.02.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works great.
Screen.Capture.on.2025-04-18.at.16-13-46.mp4
Some non-blocking notes:
- Implementing event tracking would be great.
- Leaving staging sites doesn't make much sense to me, but maybe there's a use case for it.
- Leaving P2s results in a bug. I prefer if we hide the functionality for P2s. See p1744964320470829-slack-CRWCHQGUB.
@@ -510,6 +512,38 @@ export function useActions( { | |||
isEligible: isActionEligible( 'migrate-to-wpcom', capabilities ), | |||
}, | |||
|
|||
{ | |||
id: 'leave-site', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is leaving a site considered a core action? I would consider not adding this to the actions list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Leave site" action was added to the action list because non-admin users do not have access to the Settings page, which is currently the only place where the action to leave a site exists. Adding it to the action list provides a entry point for non-admin users to leave a site.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a percentage of our current user base, how many are non-admin users and will need this entry point?
Edit:
I assume isActionEligible( 'leave-site', capabilities )
will display it for almost all users. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having it in the action list just so it's also available for non-admin users makes sense to me. I'm not too presently concerned whether it's considered a core actions or not, also we would benefit from doing an audit further down the line so that we don't clutter the menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a percentage of our current user base, how many are non-admin users and will need this entry point?
I checked on Superset by querying the count of admin vs. non-admin users. It looks like around 13% of users are non-admins. I'm not sure how many of them actively use this entry point, but it’s currently accessible via /me > Manage Blogs > Leave Blog
.
I don’t think we should remove this feature as part of the global dashboard deprecation. Instead, we could track the usage funnels around this flow and revisit whether it’s still needed in the future based on actual engagement.
I assume isActionEligible( 'leave-site', capabilities ) will display it for almost all users. Is that correct?
YES.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having it in the action list just so it's also available for non-admin users makes sense to me.
I understand this sentiment, but it's a slippery slope. We'll need guidelines in place to determine what should be added here or not.
To me, it already feels like a somewhat random collection of links that changes depending on context, with conditional items being injected in unpredictable places.



If a user can't explain why "Leave site" is in the dropdown and not "Reset site" then we probably need to reconsider our UX.
I'm not offering this as a blocker to this PR. I can open a new issue if that's more appropriate. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in agreement which is why I think an audit would be great. I don't think, for instance, "Copy site" is often used enough to be in the actions list.
0b32095
to
c7c9284
Compare
c7c9284
to
2ea3162
Compare
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/17414106 Some locales (Hebrew) have been temporarily machine-translated due to translator availability. All other translations are usually ready within a few days. Untranslated and machine-translated strings will be sent for translation next Monday and are expected to be completed by the following Friday. Thank you @arthur791004 for including a screenshot in the description! This is really helpful for our translators. |
Related to #98772
Proposed Changes
Modal
Sites
Note: The warning has been removed.
Overview > Settings (
isUntangled: true
)Note: The warning has been removed.
Settings > General (
isUntangled: false
)Note: The warning has been removed.
Why are these changes being made?
Testing Instructions
Sites
...
on any siteLeave site
actionLeave site
buttonHosting Dashboard
Leave site
buttonPre-merge Checklist