From 6dddce67fc488f62517643d0d8fb205412878d3e Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 9 Apr 2019 00:03:07 +0000 Subject: [PATCH] Privacy: Only mark a personal data export as complete when the user downloads it. An admin may download an export to check that it's all correct, but this action shouldn't mark the request as complete. Props garrett-eclipse, JoshuaWold, birgire. Fixes #44644. git-svn-id: https://develop.svn.wordpress.org/trunk@45148 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/file.php | 6 +++--- .../privacy/wpPrivacyProcessPersonalDataExportPage.php | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 435f6572a4..82d722b53d 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -2550,6 +2550,9 @@ function wp_privacy_process_personal_data_export_page( $response, $exporter_inde if ( is_wp_error( $mail_success ) ) { wp_send_json_error( $mail_success->get_error_message() ); } + + // Update the request to completed state when the export email is sent. + _wp_privacy_completed_request( $request_id ); } else { // Modify the response to include the URL of the export file so the browser can fetch it. $export_file_url = get_post_meta( $request_id, '_export_file_url', true ); @@ -2558,8 +2561,5 @@ function wp_privacy_process_personal_data_export_page( $response, $exporter_inde } } - // Update the request to completed state. - _wp_privacy_completed_request( $request_id ); - return $response; } diff --git a/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php b/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php index ab576547c9..c7d62990df 100755 --- a/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php +++ b/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php @@ -615,7 +615,7 @@ class Tests_Privacy_WpPrivacyProcessPersonalDataExportPage extends WP_UnitTestCa */ public function data_export_page_status_transitions() { return array( - // Mark the request as completed for the last exporter on the last page, with and without email. + // Mark the request as completed for the last exporter on the last page, with email. array( 'request-completed', 'last', @@ -624,8 +624,11 @@ class Tests_Privacy_WpPrivacyProcessPersonalDataExportPage extends WP_UnitTestCa true, 'last', ), + // Leave the request as pending for the last exporter on the last page, without email. + // This check was updated to account for admin vs user export. + // Don't mark the request as completed when it's an admin download. array( - 'request-completed', + 'request-pending', 'last', 'last', 'last',