Skip to content

Commit

Permalink
Fix/launch task completion (#36839)
Browse files Browse the repository at this point in the history
* Adds a complete callback to the launch site task

* changelog

* Fixed phpdoc

* Added explicit blog id

* persist task completion status

* fixing linting

* fixing changelogger validity
  • Loading branch information
nelsonec87 authored Apr 16, 2024
1 parent 52621a4 commit 11d3920
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Added completed callback for site_launched task
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ function wpcom_launchpad_get_task_definitions() {
return __( 'Launch your site', 'jetpack-mu-wpcom' );
},
'isLaunchTask' => true,
'is_complete_callback' => 'wpcom_launchpad_is_site_launched',
'add_listener_callback' => 'wpcom_launchpad_add_site_launch_listener',
),
'verify_email' => array(
Expand Down Expand Up @@ -736,6 +737,29 @@ function wpcom_launchpad_get_task_definitions() {
return array_merge( $extended_task_definitions, $task_definitions );
}

/**
* Returns true if the current site is launched.
*
* @param array $task The task object.
* @param bool $is_complete The current task status.
*
* @return boolean
*/
function wpcom_launchpad_is_site_launched( $task, $is_complete ) {
if ( $is_complete ) {
return true;
}

$launch_status = get_blog_option( get_current_blog_id(), 'launch-status' );

if ( 'launched' === $launch_status ) {
wpcom_mark_launchpad_task_complete( 'site_launched' );
return true;
} else {
return false;
}
}

/**
* Record completion event in Tracks if we're running on WP.com.
*
Expand Down

0 comments on commit 11d3920

Please sign in to comment.