From c790bd4cc3525dc121f554db39f075e88a94dd6f Mon Sep 17 00:00:00 2001 From: Dat Hoang Date: Thu, 16 Jan 2020 21:12:10 +0700 Subject: [PATCH 1/5] [not verified] Rebase from the master branch and resolve conflict after #14275 is merged --- modules/subscriptions.php | 10 ++++++++-- modules/subscriptions/views.php | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/modules/subscriptions.php b/modules/subscriptions.php index 6bb538cb3e89a..58a619706a1f9 100644 --- a/modules/subscriptions.php +++ b/modules/subscriptions.php @@ -525,6 +525,7 @@ function get_settings() { * not_subscribed : strange error. Jetpack servers at WordPress.com could subscribe the email. * disabled : Site owner has disabled subscriptions. * active : Already subscribed. + * pending : Tried to subscribe before but the confirmation link is never clicked. No confirmation email is sent. * unknown : strange error. Jetpack servers at WordPress.com returned something malformed. * unknown_status : strange error. Jetpack servers at WordPress.com returned something I didn't understand. */ @@ -587,9 +588,12 @@ function subscribe( $email, $post_ids = 0, $async = true, $extra_data = array() case 'active' : $r[] = new Jetpack_Error( 'active' ); continue 2; - case 'pending' : + case 'confirming' : $r[] = true; continue 2; + case 'pending' : + $r[] = new Jetpack_Error( 'pending' ); + continue 2; default : $r[] = new Jetpack_Error( 'unknown_status', (string) $response[0]['status'] ); continue 2; @@ -656,12 +660,14 @@ function widget_submit() { $result = 'opted_out'; break; case 'active': - case 'pending': $result = 'already'; break; case 'flooded_email': $result = 'many_pending_subs'; break; + case 'pending': + $result = 'pending'; + break; default: $result = 'error'; break; diff --git a/modules/subscriptions/views.php b/modules/subscriptions/views.php index 8b3ee03fc3f1a..55560d9b51f5b 100644 --- a/modules/subscriptions/views.php +++ b/modules/subscriptions/views.php @@ -180,6 +180,23 @@ static function render_widget_status_messages( $instance ) { ?>

+

+ Otherwise, you can manage your preferences at subscribe.wordpress.com.', 'jetpack' ), + self::$allowed_html_tags_for_message + ), + 'https://subscribe.wordpress.com/', + esc_attr__( 'Manage your email preferences.', 'jetpack' ) + ); + ?> +

+
Date: Thu, 16 Jan 2020 21:20:04 +0700 Subject: [PATCH 2/5] Fix the space issue (again) --- modules/subscriptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/subscriptions.php b/modules/subscriptions.php index 58a619706a1f9..5457c120d19c2 100644 --- a/modules/subscriptions.php +++ b/modules/subscriptions.php @@ -525,7 +525,7 @@ function get_settings() { * not_subscribed : strange error. Jetpack servers at WordPress.com could subscribe the email. * disabled : Site owner has disabled subscriptions. * active : Already subscribed. - * pending : Tried to subscribe before but the confirmation link is never clicked. No confirmation email is sent. + * pending : Tried to subscribe before but the confirmation link is never clicked. No confirmation email is sent. * unknown : strange error. Jetpack servers at WordPress.com returned something malformed. * unknown_status : strange error. Jetpack servers at WordPress.com returned something I didn't understand. */ From ee0f3a379e63e4da303032afabe7affeeaa7ef6c Mon Sep 17 00:00:00 2001 From: Dat Hoang Date: Mon, 20 Jan 2020 21:13:26 +0700 Subject: [PATCH 3/5] Add rel attribute Co-Authored-By: Jeremy Herve --- modules/subscriptions/views.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/subscriptions/views.php b/modules/subscriptions/views.php index 55560d9b51f5b..cbe51c64eed83 100644 --- a/modules/subscriptions/views.php +++ b/modules/subscriptions/views.php @@ -187,7 +187,7 @@ static function render_widget_status_messages( $instance ) { printf( wp_kses( /* translators: 1: Link to Subscription Management page https://subscribe.wordpress.com/, 2: Description of this link */ - __( 'You subscribed this site before but you have not clicked the confirmation link yet. Please check your mailbox.
Otherwise, you can manage your preferences at subscribe.wordpress.com.', 'jetpack' ), + __( 'You subscribed this site before but you have not clicked the confirmation link yet. Please check your mailbox.
Otherwise, you can manage your preferences at subscribe.wordpress.com.', 'jetpack' ), self::$allowed_html_tags_for_message ), 'https://subscribe.wordpress.com/', From 5d580446a1cc7c85f420d9e3506b3e357b07461f Mon Sep 17 00:00:00 2001 From: Dat Hoang Date: Mon, 20 Jan 2020 22:10:28 +0700 Subject: [PATCH 4/5] Fix PHPCS error for switch statement --- modules/subscriptions.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/subscriptions.php b/modules/subscriptions.php index 5457c120d19c2..47f7499089d19 100644 --- a/modules/subscriptions.php +++ b/modules/subscriptions.php @@ -579,24 +579,24 @@ function subscribe( $email, $post_ids = 0, $async = true, $extra_data = array() } switch ( $response[0]['status'] ) { - case 'error' : - $r[] = new Jetpack_Error( 'not_subscribed' ); - continue 2; - case 'disabled' : - $r[] = new Jetpack_Error( 'disabled' ); - continue 2; - case 'active' : - $r[] = new Jetpack_Error( 'active' ); - continue 2; - case 'confirming' : - $r[] = true; - continue 2; - case 'pending' : - $r[] = new Jetpack_Error( 'pending' ); - continue 2; - default : - $r[] = new Jetpack_Error( 'unknown_status', (string) $response[0]['status'] ); - continue 2; + case 'error': + $r[] = new Jetpack_Error( 'not_subscribed' ); + continue 2; + case 'disabled': + $r[] = new Jetpack_Error( 'disabled' ); + continue 2; + case 'active': + $r[] = new Jetpack_Error( 'active' ); + continue 2; + case 'confirming': + $r[] = true; + continue 2; + case 'pending': + $r[] = new Jetpack_Error( 'pending' ); + continue 2; + default: + $r[] = new Jetpack_Error( 'unknown_status', (string) $response[0]['status'] ); + continue 2; } } From 152aeb078f4f34c91cc17f945d372332fa784ace Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Fri, 24 Jan 2020 12:08:28 -0600 Subject: [PATCH 5/5] Update wording. --- modules/subscriptions/views.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/subscriptions/views.php b/modules/subscriptions/views.php index cbe51c64eed83..25a6540565dc5 100644 --- a/modules/subscriptions/views.php +++ b/modules/subscriptions/views.php @@ -187,7 +187,7 @@ static function render_widget_status_messages( $instance ) { printf( wp_kses( /* translators: 1: Link to Subscription Management page https://subscribe.wordpress.com/, 2: Description of this link */ - __( 'You subscribed this site before but you have not clicked the confirmation link yet. Please check your mailbox.
Otherwise, you can manage your preferences at subscribe.wordpress.com.', 'jetpack' ), + __( 'You subscribed this site before but you have not clicked the confirmation link yet. Please check your inbox.
Otherwise, you can manage your preferences at subscribe.wordpress.com.', 'jetpack' ), self::$allowed_html_tags_for_message ), 'https://subscribe.wordpress.com/',