-
Notifications
You must be signed in to change notification settings - Fork 179
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
Settings: Add checkbox for data removal upon uninstall #11925
Conversation
a9ea15c
to
6b40548
Compare
09ead76
to
56756c1
Compare
Size Change: +1.16 kB (0%) Total Size: 2.66 MB
ℹ️ View Unchanged
|
Plugin builds for bbcd54f are ready 🛎️!
|
packages/wp-dashboard/src/components/editorSettings/dataRemoval/index.js
Outdated
Show resolved
Hide resolved
packages/wp-dashboard/src/components/editorSettings/dataRemoval/index.js
Outdated
Show resolved
Hide resolved
…l/index.js Co-authored-by: Pascal Birchler <pascalb@google.com>
…l/index.js Co-authored-by: Pascal Birchler <pascalb@google.com>
Hmm right, looks like we need to include the autoloader in But that's weird, because we use these classes heavily in Does that mean it never worked? 🤔 |
Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com>
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.
Seems to work well in my testing.
@felipebochehin87 For QA on this PR, please do not do it on the QA site. Instead, create a new local site (e.g. in localwp.com), install the production build from #11925 (comment), create some stories, and see if the stories are properly deleted on uninstall. So when you install the plugin again there should be no stories anymore. Hope that makes sense. |
It does @swissspidy thanks a lot for the info! |
@swissspidy @spacedmonkey @timarney please let me know if I am doing something wrong:
I follow this steps, but when I install again the plugin, I see the old stories. |
@felipebochehin87 With this PR, there's a new "Data Removal" checkbox on the Settings page. Only when you check that should the data be removed. @timarney If you could add a screenshot under the "User-facing changes" section that would be tremendously useful. |
@felipebochehin87 --- I added a screenshot in the summary above. |
Thanks @timarney @swissspidy I still see some weird things - steps 3 and 4.
|
Indeed I see that too. @timarney Can you check this again please? You might need to add a |
Tested with For reference, this is the error that happens:
With the following change the plugin is initialized properly for uninstall and there are no longer any fatal errors: if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
return;
}
if ( ! defined( 'WEBSTORIES_VERSION' ) ) {
define( 'WEBSTORIES_VERSION', '1' );
}
if ( ! defined( 'WEBSTORIES_DEV_MODE' ) ) {
define( 'WEBSTORIES_DEV_MODE', false );
}
if ( ! defined( 'WEBSTORIES_PLUGIN_DIR_FILE' ) ) {
define( 'WEBSTORIES_PLUGIN_FILE', __DIR__ . '/web-stories.php' );
}
if ( ! defined( 'WEBSTORIES_PLUGIN_DIR_PATH' ) ) {
define( 'WEBSTORIES_PLUGIN_DIR_PATH', __DIR__ );
}
if ( ! defined( 'WEBSTORIES_PLUGIN_DIR_URL' ) ) {
define( 'WEBSTORIES_PLUGIN_DIR_URL', plugin_dir_url( WEBSTORIES_PLUGIN_FILE ) );
}
// Autoloader for dependencies.
if ( file_exists( WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php' ) ) {
require WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php';
}
// Autoloader for plugin itself.
if ( file_exists( WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php' ) ) {
require WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php';
}
\Google\Web_Stories\PluginFactory::create()->register(); That said, it feels super overkill to me, since we don't use the services much in |
I didnt see these error locally |
Updated and tested with changes from #11925 (comment) |
It works 🎉 🎉 Only found two unrelated bugs with the uninstall code. First, draft stories are not deleted. To fix this, we need to add web-stories-wp/includes/uninstall.php Lines 154 to 162 in 7109307
Second, the web-stories-wp/includes/uninstall.php Lines 183 to 187 in 7109307
Can do it in a loop, i.e. foreach ( $taxonomies as $taxonomy ) {
clean_taxonomy_cache( $taxonomy );
} Can you add this in this PR? Then it should be good to go! |
@felipebochehin87 Now it should work! 🤞 |
|
Context
Data removal is off by default though and needs to be enabled by filtering web_stories_erase_data_on_uninstall we need to add a UI to allow users to toggle this option.
Summary
Adds checkbox to the story settings page.
Relevant Technical Choices
To-do
Update text as needed.
User-facing changes
Testing Instructions
This PR can be tested by following these steps:
Reviews
Does this PR have a security-related impact?
Does this PR change what data or activity we track or use?
Does this PR have a legal-related impact?
Checklist
Type: XYZ
label to the PRFixes #8453