Privacy: cleanup of the "Export Personal Data" and "Erase Personal Data" screens.

Props desrosj, xkon.
See #43929.

git-svn-id: https://develop.svn.wordpress.org/trunk@43212 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2018-05-10 10:00:19 +00:00
parent dd4322535b
commit 56079a45fd
4 changed files with 118 additions and 95 deletions

View File

@ -1132,6 +1132,18 @@ table.form-table td .updated p {
border-left-color: #d64d21; border-left-color: #d64d21;
} }
.privacy_requests .request-results .notice {
margin: -2px 0 0;
}
.privacy_requests .request-results .notice p {
margin: 0.5em 0;
}
.request-results td {
padding: 0 0 1px;
}
.status-label { .status-label {
font-weight: 600; font-weight: 600;
} }

View File

@ -663,7 +663,6 @@ function _wp_personal_data_handle_actions() {
'updated' 'updated'
); );
} }
} elseif ( isset( $_POST['action'] ) ) { } elseif ( isset( $_POST['action'] ) ) {
$action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok. $action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok.
@ -760,7 +759,7 @@ function _wp_personal_data_cleanup_requests() {
'posts_per_page' => -1, 'posts_per_page' => -1,
'post_status' => 'request-pending', 'post_status' => 'request-pending',
'fields' => 'ids', 'fields' => 'ids',
'date_query' => array( 'date_query' => array(
array( array(
'column' => 'post_modified_gmt', 'column' => 'post_modified_gmt',
'before' => $expires . ' seconds ago', 'before' => $expires . ' seconds ago',
@ -1112,7 +1111,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
* @return array * @return array
*/ */
protected function get_views() { protected function get_views() {
$current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ): ''; $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
$statuses = _wp_privacy_statuses(); $statuses = _wp_privacy_statuses();
$views = array(); $views = array();
$admin_url = admin_url( 'tools.php?page=' . $this->request_type ); $admin_url = admin_url( 'tools.php?page=' . $this->request_type );
@ -1151,7 +1150,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
public function process_bulk_action() { public function process_bulk_action() {
$action = $this->current_action(); $action = $this->current_action();
$request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); // WPCS: input var ok, CSRF ok. $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); // WPCS: input var ok, CSRF ok.
$count = 0; $count = 0;
if ( $request_ids ) { if ( $request_ids ) {
check_admin_referer( 'bulk-privacy_requests' ); check_admin_referer( 'bulk-privacy_requests' );
@ -1168,6 +1167,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
add_settings_error( add_settings_error(
'bulk_action', 'bulk_action',
'bulk_action', 'bulk_action',
/* translators: %d: number of requests */
sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ), sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ),
'updated' 'updated'
); );
@ -1184,6 +1184,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
add_settings_error( add_settings_error(
'bulk_action', 'bulk_action',
'bulk_action', 'bulk_action',
/* translators: %d: number of requests */
sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ), sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ),
'updated' 'updated'
); );
@ -1213,7 +1214,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
'post_type' => $this->post_type, 'post_type' => $this->post_type,
'post_name__in' => array( $this->request_type ), 'post_name__in' => array( $this->request_type ),
'posts_per_page' => $posts_per_page, 'posts_per_page' => $posts_per_page,
'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0, 'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0,
'post_status' => 'any', 'post_status' => 'any',
's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',
); );
@ -1305,6 +1306,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
$time_diff = current_time( 'timestamp', true ) - $timestamp; $time_diff = current_time( 'timestamp', true ) - $timestamp;
if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) { if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
/* translators: human readable timestamp */
return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) ); return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
} }
@ -1412,21 +1414,21 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
$request_id = $item->ID; $request_id = $item->ID;
$nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
$download_data_markup = '<div class="export_personal_data" ' . $download_data_markup = '<div class="export-personal-data" ' .
'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' . 'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
'data-request-id="' . esc_attr( $request_id ) . '" ' . 'data-request-id="' . esc_attr( $request_id ) . '" ' .
'data-nonce="' . esc_attr( $nonce ) . 'data-nonce="' . esc_attr( $nonce ) .
'">'; '">';
$download_data_markup .= '<span class="export_personal_data_idle"><a href="#" >' . __( 'Download Personal Data' ) . '</a></span>' . $download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
'<span style="display:none" class="export_personal_data_processing" >' . __( 'Downloading Data...' ) . '</span>' . '<span style="display:none" class="export-personal-data-processing" >' . __( 'Downloading Data...' ) . '</span>' .
'<span style="display:none" class="export_personal_data_success"><a href="#" >' . __( 'Download Personal Data Again' ) . '</a></span>' . '<span style="display:none" class="export-personal-data-success"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data Again' ) . '</button></span>' .
'<span style="display:none" class="export_personal_data_failed">' . __( 'Download has failed.' ) . ' <a href="#" >' . __( 'Retry' ) . '</a></span>'; '<span style="display:none" class="export-personal-data-failed">' . __( 'Download has failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
$download_data_markup .= '</div>'; $download_data_markup .= '</div>';
$row_actions = array( $row_actions = array(
'download_data' => $download_data_markup, 'download-data' => $download_data_markup,
); );
return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) ); return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) );
@ -1452,7 +1454,7 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
$request_id = $item->ID; $request_id = $item->ID;
$nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
echo '<div class="export_personal_data" ' . echo '<div class="export-personal-data" ' .
'data-send-as-email="1" ' . 'data-send-as-email="1" ' .
'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' . 'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
'data-request-id="' . esc_attr( $request_id ) . '" ' . 'data-request-id="' . esc_attr( $request_id ) . '" ' .
@ -1460,10 +1462,10 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
'">'; '">';
?> ?>
<span class="export_personal_data_idle"><a class="button" href="#" ><?php _e( 'Send Export Link' ); ?></a></span> <span class="export-personal-data-idle"><button type="button" class="button export-personal-data-handle"><?php _e( 'Email Data' ); ?></button></span>
<span style="display:none" class="export_personal_data_processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span> <span style="display:none" class="export-personal-data-processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span>
<span style="display:none" class="export_personal_data_success success-message" ><?php _e( 'Email sent.' ); ?></span> <span style="display:none" class="export-personal-data-success success-message" ><?php _e( 'Email sent.' ); ?></span>
<span style="display:none" class="export_personal_data_failed"><?php _e( 'Email could not be sent.' ); ?> <a class="button" href="#" ><?php _e( 'Retry' ); ?></a></span> <span style="display:none" class="export-personal-data-failed"><?php _e( 'Email could not be sent.' ); ?> <button type="button" class="button export-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
<?php <?php
echo '</div>'; echo '</div>';
@ -1473,9 +1475,9 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
break; break;
case 'request-completed': case 'request-completed':
echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array( echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
'action' => 'delete', 'action' => 'delete',
'request_id' => array( $item->ID ) 'request_id' => array( $item->ID ),
), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>'; ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
break; break;
} }
} }
@ -1524,20 +1526,20 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
$request_id = $item->ID; $request_id = $item->ID;
$nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
$remove_data_markup = '<div class="remove_personal_data force_remove_personal_data" ' . $remove_data_markup = '<div class="remove-personal-data force-remove-personal-data" ' .
'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' . 'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
'data-request-id="' . esc_attr( $request_id ) . '" ' . 'data-request-id="' . esc_attr( $request_id ) . '" ' .
'data-nonce="' . esc_attr( $nonce ) . 'data-nonce="' . esc_attr( $nonce ) .
'">'; '">';
$remove_data_markup .= '<span class="remove_personal_data_idle"><a href="#" >' . __( 'Force Erase Personal Data' ) . '</a></span>' . $remove_data_markup .= '<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle">' . __( 'Force Erase Personal Data' ) . '</button></span>' .
'<span style="display:none" class="remove_personal_data_processing" >' . __( 'Erasing Data...' ) . '</span>' . '<span style="display:none" class="remove-personal-data-processing" >' . __( 'Erasing Data...' ) . '</span>' .
'<span style="display:none" class="remove_personal_data_failed">' . __( 'Force Erase has failed.' ) . ' <a href="#" >' . __( 'Retry' ) . '</a></span>'; '<span style="display:none" class="remove-personal-data-failed">' . __( 'Force Erase has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
$remove_data_markup .= '</div>'; $remove_data_markup .= '</div>';
$row_actions = array( $row_actions = array(
'remove_data' => $remove_data_markup, 'remove-data' => $remove_data_markup,
); );
} }
@ -1564,7 +1566,7 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
$request_id = $item->ID; $request_id = $item->ID;
$nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
echo '<div class="remove_personal_data" ' . echo '<div class="remove-personal-data" ' .
'data-force-erase="1" ' . 'data-force-erase="1" ' .
'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' . 'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
'data-request-id="' . esc_attr( $request_id ) . '" ' . 'data-request-id="' . esc_attr( $request_id ) . '" ' .
@ -1572,9 +1574,9 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
'">'; '">';
?> ?>
<span class="remove_personal_data_idle"><a class="button" href="#" ><?php _e( 'Erase Personal Data' ); ?></a></span> <span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
<span style="display:none" class="remove_personal_data_processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span> <span style="display:none" class="remove-personal-data-processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span>
<span style="display:none" class="remove_personal_data_failed"><?php _e( 'Erasing Data has failed.' ); ?> <a class="button" href="#" ><?php _e( 'Retry' ); ?></a></span> <span style="display:none" class="remove-personal-data-failed"><?php _e( 'Erasing Data has failed.' ); ?> <button type="button" class="button remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
<?php <?php
echo '</div>'; echo '</div>';
@ -1585,9 +1587,9 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
break; break;
case 'request-completed': case 'request-completed':
echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array( echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
'action' => 'delete', 'action' => 'delete',
'request_id' => array( $item->ID ), 'request_id' => array( $item->ID ),
), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>'; ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
break; break;
} }
} }

View File

@ -25,7 +25,7 @@ jQuery( document ).ready(function( $ ) {
jQuery( document ).ready( function( $ ) { jQuery( document ).ready( function( $ ) {
var strings = window.privacyToolsL10n || {}; var strings = window.privacyToolsL10n || {};
function set_action_state( $action, state ) { function setActionState( $action, state ) {
$action.children().hide(); $action.children().hide();
$action.children( '.' + state ).show(); $action.children( '.' + state ).show();
} }
@ -37,13 +37,14 @@ jQuery( document ).ready( function( $ ) {
} }
function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) { function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) {
var itemList = '';
clearResultsAfterRow( $requestRow ); clearResultsAfterRow( $requestRow );
var itemList = '';
if ( additionalMessages.length ) { if ( additionalMessages.length ) {
$.each( additionalMessages, function( index, value ) { $.each( additionalMessages, function( index, value ) {
itemList = itemList + '<li>' + value + '</li>'; itemList = itemList + '<li>' + value + '</li>';
} ); });
itemList = '<ul>' + itemList + '</ul>'; itemList = '<ul>' + itemList + '</ul>';
} }
@ -55,41 +56,42 @@ jQuery( document ).ready( function( $ ) {
'</div>' + '</div>' +
'</td>' + '</td>' +
'</tr>'; '</tr>';
} ); });
} }
$( '.export_personal_data a' ).click( function( event ) { $( '.export-personal-data-handle' ).click( function( event ) {
var $this = $( this ),
$action = $this.parents( '.export-personal-data' ),
$requestRow = $this.parents( 'tr' ),
requestID = $action.data( 'request-id' ),
nonce = $action.data( 'nonce' ),
exportersCount = $action.data( 'exporters-count' ),
sendAsEmail = $action.data( 'send-as-email' ) ? true : false;
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
var $this = $( this );
var $action = $this.parents( '.export_personal_data' );
var $requestRow = $this.parents( 'tr' );
var requestID = $action.data( 'request-id' );
var nonce = $action.data( 'nonce' );
var exportersCount = $action.data( 'exporters-count' );
var sendAsEmail = $action.data( 'send-as-email' ) ? true : false;
$action.blur(); $action.blur();
clearResultsAfterRow( $requestRow ); clearResultsAfterRow( $requestRow );
function on_export_done_success( zipUrl ) { function onExportDoneSuccess( zipUrl ) {
set_action_state( $action, 'export_personal_data_success' ); setActionState( $action, 'export-personal-data-success' );
if ( 'undefined' !== typeof zipUrl ) { if ( 'undefined' !== typeof zipUrl ) {
window.location = zipUrl; window.location = zipUrl;
} else if ( ! sendAsEmail ) { } else if ( ! sendAsEmail ) {
on_export_failure( strings.noExportFile ); onExportFailure( strings.noExportFile );
} }
} }
function on_export_failure( errorMessage ) { function onExportFailure( errorMessage ) {
set_action_state( $action, 'export_personal_data_failed' ); setActionState( $action, 'export-personal-data-failed' );
if ( errorMessage ) { if ( errorMessage ) {
appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] ); appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] );
} }
} }
function do_next_export( exporterIndex, pageIndex ) { function doNextExport( exporterIndex, pageIndex ) {
$.ajax( $.ajax(
{ {
url: window.ajaxurl, url: window.ajaxurl,
@ -104,54 +106,59 @@ jQuery( document ).ready( function( $ ) {
method: 'post' method: 'post'
} }
).done( function( response ) { ).done( function( response ) {
var responseData = response.data;
if ( ! response.success ) { if ( ! response.success ) {
// e.g. invalid request ID // e.g. invalid request ID
on_export_failure( response.data ); onExportFailure( response.data );
return; return;
} }
var responseData = response.data;
if ( ! responseData.done ) { if ( ! responseData.done ) {
setTimeout( do_next_export( exporterIndex, pageIndex + 1 ) ); setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
} else { } else {
if ( exporterIndex < exportersCount ) { if ( exporterIndex < exportersCount ) {
setTimeout( do_next_export( exporterIndex + 1, 1 ) ); setTimeout( doNextExport( exporterIndex + 1, 1 ) );
} else { } else {
on_export_done_success( responseData.url ); onExportDoneSuccess( responseData.url );
} }
} }
} ).fail( function( jqxhr, textStatus, error ) { }).fail( function( jqxhr, textStatus, error ) {
// e.g. Nonce failure // e.g. Nonce failure
on_export_failure( error ); onExportFailure( error );
} ); });
} }
// And now, let's begin // And now, let's begin
set_action_state( $action, 'export_personal_data_processing' ); setActionState( $action, 'export-personal-data-processing' );
do_next_export( 1, 1 ); doNextExport( 1, 1 );
} ); });
$( '.remove-personal-data-handle' ).click( function( event ) {
var $this = $( this ),
$action = $this.parents( '.remove-personal-data' ),
$requestRow = $this.parents( 'tr' ),
requestID = $action.data( 'request-id' ),
nonce = $action.data( 'nonce' ),
erasersCount = $action.data( 'erasers-count' ),
hasRemoved = false,
hasRetained = false,
messages = [];
$( '.remove_personal_data a' ).click( function( event ) {
event.preventDefault();
event.stopPropagation(); event.stopPropagation();
var $this = $( this );
var $action = $this.parents( '.remove_personal_data' );
var $requestRow = $this.parents( 'tr' );
var requestID = $action.data( 'request-id' );
var nonce = $action.data( 'nonce' );
var erasersCount = $action.data( 'erasers-count' );
var hasRemoved = false;
var hasRetained = false;
var messages = [];
$action.blur(); $action.blur();
clearResultsAfterRow( $requestRow ); clearResultsAfterRow( $requestRow );
function on_erasure_done_success() { function onErasureDoneSuccess() {
set_action_state( $action, 'remove_personal_data_idle' );
var summaryMessage = strings.noDataFound; var summaryMessage = strings.noDataFound;
var classes = 'notice-success'; var classes = 'notice-success';
setActionState( $action, 'remove-personal-data-idle' );
if ( false === hasRemoved ) { if ( false === hasRemoved ) {
if ( false === hasRetained ) { if ( false === hasRetained ) {
summaryMessage = strings.noDataFound; summaryMessage = strings.noDataFound;
@ -170,13 +177,13 @@ jQuery( document ).ready( function( $ ) {
appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, messages ); appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, messages );
} }
function on_erasure_failure() { function onErasureFailure() {
set_action_state( $action, 'remove_personal_data_failed' ); setActionState( $action, 'remove-personal-data-failed' );
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] ); appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
} }
function do_next_erasure( eraserIndex, pageIndex ) { function doNextErasure( eraserIndex, pageIndex ) {
$.ajax( { $.ajax({
url: window.ajaxurl, url: window.ajaxurl,
data: { data: {
action: 'wp-privacy-erase-personal-data', action: 'wp-privacy-erase-personal-data',
@ -186,12 +193,13 @@ jQuery( document ).ready( function( $ ) {
security: nonce security: nonce
}, },
method: 'post' method: 'post'
} ).done( function( response ) { }).done( function( response ) {
var responseData = response.data;
if ( ! response.success ) { if ( ! response.success ) {
on_erasure_failure(); onErasureFailure();
return; return;
} }
var responseData = response.data;
if ( responseData.items_removed ) { if ( responseData.items_removed ) {
hasRemoved = hasRemoved || responseData.items_removed; hasRemoved = hasRemoved || responseData.items_removed;
} }
@ -202,27 +210,28 @@ jQuery( document ).ready( function( $ ) {
messages = messages.concat( responseData.messages ); messages = messages.concat( responseData.messages );
} }
if ( ! responseData.done ) { if ( ! responseData.done ) {
setTimeout( do_next_erasure( eraserIndex, pageIndex + 1 ) ); setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
} else { } else {
if ( eraserIndex < erasersCount ) { if ( eraserIndex < erasersCount ) {
setTimeout( do_next_erasure( eraserIndex + 1, 1 ) ); setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
} else { } else {
on_erasure_done_success(); onErasureDoneSuccess();
} }
} }
} ).fail( function() { }).fail( function() {
on_erasure_failure(); onErasureFailure();
} ); });
} }
// And now, let's begin // And now, let's begin
set_action_state( $action, 'remove_personal_data_processing' ); setActionState( $action, 'remove-personal-data-processing' );
do_next_erasure( 1, 1 ); doNextErasure( 1, 1 );
} ); });
} ); });
( function( $ ) { ( function( $ ) {
// Privacy policy page, copy button. // Privacy policy page, copy button.
$( document ).on( 'click', function( event ) { $( document ).on( 'click', function( event ) {
var $target = $( event.target ); var $target = $( event.target );
@ -253,4 +262,4 @@ jQuery( document ).ready( function( $ ) {
} }
}); });
} )( jQuery ); } ( jQuery ) );

View File

@ -3078,7 +3078,7 @@ function _wp_privacy_account_request_confirmed_message( $message, $request_id )
$request = wp_get_user_request_data( $request_id ); $request = wp_get_user_request_data( $request_id );
if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) { if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) {
$message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>'; $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>';
$message .= __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ); $message .= __( 'The site administrator has been notified and will fulfill your request as soon as possible.' );
} }
@ -3111,7 +3111,7 @@ function wp_create_user_request( $email_address = '', $action_name = '', $reques
} }
$user = get_user_by( 'email', $email_address ); $user = get_user_by( 'email', $email_address );
$user_id = $user && ! is_wp_error( $user ) ? $user->ID: 0; $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0;
// Check for duplicates. // Check for duplicates.
$requests_query = new WP_Query( array( $requests_query = new WP_Query( array(