-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Site Settings: Make it impossible for users to delete a site with active subscriptions #1246
Conversation
48050a2
to
c7c7189
Compare
This looks good to me. It works as advertised and I don't have any comments on the code. I'm happy for you to merge, but I'll look more in detail tomorrow if you'd rather. |
@scruffian Thanks for taking a look. Either works for me. |
Would a placeholder be better? |
Code looks good, and the server side patch can be deployed. My only concern is that by not showing the delete section until the endpoint has loaded, so users might get confused. |
To be honest, I don't remember why I needed that ... I guess I added it when I did all the pinned notices stuff, but I've just tested your branch and everything seems to be working as usual /shrug |
Dispatcher.handleViewAction( { | ||
type: 'DELETE_SITE', | ||
site: site | ||
} ); | ||
|
||
debug( 'Deleting site', site ); | ||
wpcom.deleteSite( site.ID, SitesListActions.receiveDeletedSite ); | ||
|
||
wpcom.deleteSite( site.ID, function( error, data ) { |
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 would be so nice if we could do all this wpcom methods to return promises someday :/
I left a minor comment, but codewise looks good to me too |
c7c7189
to
f3c01be
Compare
Yes, but that is out of scope for this PR, which just fixes the existing behavior. There are multiple settings on that page that "pop in" after a response from the API. I'll open an issue for it after this is merged if one doesn't already exist. |
Ok sounds good. In that case 🚢 |
…d from the API This was the original behavior of `DeleteSite`, and prevents users from deleting sites with active subscriptions.
Otherwise, `<DeleteSiteNotices />` isn't rendered.
f3c01be
to
6d4711d
Compare
…ptions Site Settings: Make it impossible for users to delete a site with active subscriptions
Did you do this? |
Nice! Good work @drewblaisdell! |
Fixes #1110.
Currently, it is possible to delete a site that has active subscriptions by either:
/settings/general/:site
and clicking the 'Delete Site' link fromDeleteSiteOptions
before the purchases have been fetched from the API./settings/delete-site/:site
directly.This PR addresses this by:
DeleteSiteOptions
until the purchases have been loaded from the API (this is how this component used to behave).NoticesList
so that it renders even when passed an empty array of notices, ensuring thatDeleteSiteNotices
is rendered (this is how the this component used to behave).@johnHackworth I believe the inverse change of this commit was added by you a couple months ago. Do you know of any issues with removing that check in
NoticesList
?Testing
/settings/general/:site
for a site with an active subscription (e.g. a premium plan)./settings/delete-site/:site
for a site with an active subscription.