Skip to content

Commit

Permalink
Deprecate onboarding task snooze APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
chihsuan committed May 12, 2023
1 parent 7e3729c commit c30d63c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/woocommerce/src/Admin/API/OnboardingTasks.php
Expand Up @@ -295,10 +295,14 @@ public function hide_task_list_permission_check( $request ) {
/**
* Check if a given request has access to manage woocommerce.
*
* @deprecated 7.8.0 snooze task is deprecated.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function snooze_task_permissions_check( $request ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );

if ( ! current_user_can( 'manage_woocommerce' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to snooze onboarding tasks.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
Expand Down Expand Up @@ -816,11 +820,15 @@ public function undo_dismiss_task( $request ) {
/**
* Snooze an onboarding task.
*
* @deprecated 7.8.0 snooze task is deprecated.
*
* @param WP_REST_Request $request Request data.
*
* @return WP_REST_Response|WP_Error
*/
public function snooze_task( $request ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );

$task_id = $request->get_param( 'id' );
$task_list_id = $request->get_param( 'task_list_id' );
$duration = $request->get_param( 'duration' );
Expand Down Expand Up @@ -853,10 +861,14 @@ public function snooze_task( $request ) {
/**
* Undo snooze of a single task.
*
* @deprecated 7.8.0 undo snooze task is deprecated.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|WP_Error
*/
public function undo_snooze_task( $request ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );

$id = $request->get_param( 'id' );
$task = TaskLists::get_task( $id );

Expand Down

0 comments on commit c30d63c

Please sign in to comment.