Skip to content

Commit

Permalink
Blogger Launchpad - add add_first_subscribers and verify_email tasks. (
Browse files Browse the repository at this point in the history
…#41502)

* add subscribers modal task to write

* add changelog

* add add_first_subscribers task to write intent

* update changelog

* dont map add_first_subscribers to the subscribers_added task

* add verify email task to blogger launchpad tasks

* add custom completion callback for add_first_subscribers task

* update changelog

* fix typo in changelog

* update comment for new task definition
  • Loading branch information
Addison-Stavlo authored Feb 7, 2025
1 parent 5f5dbb8 commit 34f09b7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: minor
Type: added

Defines a new launchpad task: add_first_subscribers.
Adds the add_first_subscribers task and verify_email task to the blogger launchpad ('write' intent).
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,18 @@ function wpcom_launchpad_get_task_definitions() {
return '/subscribers/' . $data['site_slug_encoded'] . '#add-subscribers';
},
),
'add_first_subscribers' => array(
// We do not want this mapped to the 'subscribers_added' task, since this task supports
// being marked as complete in situations where subscribers are not added.
'get_title' => function () {
return __( 'Add your first subscribers', 'jetpack-mu-wpcom' );
},
'is_complete_callback' => 'wpcom_launchpad_is_add_first_subscribers_completed',
'is_visible_callback' => '__return_true',
'get_calypso_path' => function ( $task, $default, $data ) {
return '/subscribers/' . $data['site_slug_encoded'] . '#add-subscribers';
},
),
'add_subscribe_block' => array(
'get_title' => function () {
return __( 'Add the Subscribe Block to your site', 'jetpack-mu-wpcom' );
Expand Down Expand Up @@ -2699,6 +2711,25 @@ function wpcom_launchpad_is_domain_customize_completed( $task, $default ) {
return $default;
}

/**
* Determines whether the add_first_subscribers task is complete by checking both the task option
* and related tasks like subscribers_added and import_subscribers.
*
* This exists because we need a 1-way relationship between these tasks: completion of other
* subscriber tasks implies add_first_subscribers is completed, but completion of
* add_first_subscribers does not imply completion of other subscriber tasks. This is because
* add_first_subscribers is allowed to be marked complete at times when no subscribers are actually
* added, and why using id_map here will not work since it creates a 2-way relationship.
*
* @param Task $task The Task object.
* @return bool True if either condition is met.
*/
function wpcom_launchpad_is_add_first_subscribers_completed( $task ) {
return wpcom_launchpad_is_task_option_completed( $task )
|| wpcom_is_checklist_task_complete( 'subscribers_added' )
|| wpcom_is_checklist_task_complete( 'import_subscribers' );
}

/**
* Mark `domain_claim`, `domain_upsell`, and `domain_upsell_deferred` tasks complete
* when a domain product is activated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ function wpcom_launchpad_get_task_list_definitions() {
'setup_write',
'design_completed',
'plan_selected',
'verify_email',
'add_first_subscribers',
'first_post_published',
'site_launched',
),
Expand Down

0 comments on commit 34f09b7

Please sign in to comment.