From ae7252dd17d3ca0ed437164c2665e69fc736cfd9 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Wed, 27 Nov 2024 21:45:47 -0800 Subject: [PATCH] Social | Make resharing async in classic editor (#40302) * Social | Make resharing async in classic editor * Update messaging --- .../update-social-make-resharing-async-in-classic-editor | 4 ++++ .../publicize-components/src/components/share-post/index.jsx | 2 +- .../update-social-make-resharing-async-in-classic-editor | 4 ++++ projects/packages/publicize/src/class-rest-controller.php | 5 +++++ .../packages/publicize/src/js/classic-editor-connections.js | 3 ++- ...class-wpcom-rest-api-v2-endpoint-publicize-share-post.php | 5 +++++ .../update-social-make-resharing-async-in-classic-editor | 4 ++++ 7 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 projects/js-packages/publicize-components/changelog/update-social-make-resharing-async-in-classic-editor create mode 100644 projects/packages/publicize/changelog/update-social-make-resharing-async-in-classic-editor create mode 100644 projects/plugins/jetpack/changelog/update-social-make-resharing-async-in-classic-editor diff --git a/projects/js-packages/publicize-components/changelog/update-social-make-resharing-async-in-classic-editor b/projects/js-packages/publicize-components/changelog/update-social-make-resharing-async-in-classic-editor new file mode 100644 index 0000000000000..a9e1ff3a629eb --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/update-social-make-resharing-async-in-classic-editor @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Social | Updated messaging for async sharing in block editor diff --git a/projects/js-packages/publicize-components/src/components/share-post/index.jsx b/projects/js-packages/publicize-components/src/components/share-post/index.jsx index aa0e7032d3cbd..03da8c8b10f5e 100644 --- a/projects/js-packages/publicize-components/src/components/share-post/index.jsx +++ b/projects/js-packages/publicize-components/src/components/share-post/index.jsx @@ -39,7 +39,7 @@ function showErrorNotice( message = __( 'Unable to share the Post', 'jetpack' ) */ function showSuccessNotice() { const { createSuccessNotice } = dispatch( noticesStore ); - createSuccessNotice( __( 'Your post will be shared soon.', 'jetpack' ), { + createSuccessNotice( __( 'Request submitted successfully.', 'jetpack' ), { id: 'publicize-post-share-message', type: 'snackbar', } ); diff --git a/projects/packages/publicize/changelog/update-social-make-resharing-async-in-classic-editor b/projects/packages/publicize/changelog/update-social-make-resharing-async-in-classic-editor new file mode 100644 index 0000000000000..a1205aeded0e3 --- /dev/null +++ b/projects/packages/publicize/changelog/update-social-make-resharing-async-in-classic-editor @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Social | Made resharing async in classic editor to fix timeout issues diff --git a/projects/packages/publicize/src/class-rest-controller.php b/projects/packages/publicize/src/class-rest-controller.php index e9501e80eef81..6aa917f5780e5 100644 --- a/projects/packages/publicize/src/class-rest-controller.php +++ b/projects/packages/publicize/src/class-rest-controller.php @@ -126,6 +126,11 @@ public function register_rest_routes() { return array_map( 'absint', $param ); }, ), + 'async' => array( + 'description' => __( 'Whether to share the post asynchronously.', 'jetpack-publicize-pkg' ), + 'type' => 'boolean', + 'default' => false, + ), ), ) ); diff --git a/projects/packages/publicize/src/js/classic-editor-connections.js b/projects/packages/publicize/src/js/classic-editor-connections.js index 736cff0e84675..e92a32f34b589 100644 --- a/projects/packages/publicize/src/js/classic-editor-connections.js +++ b/projects/packages/publicize/src/js/classic-editor-connections.js @@ -239,10 +239,11 @@ jQuery( function ( $ ) { data: { message, skipped_connections, + async: true, }, } ) .then( () => { - showNotice( __( 'Your post has been shared!', 'jetpack-publicize-pkg' ), 'success' ); + showNotice( __( 'Request submitted successfully.', 'jetpack-publicize-pkg' ), 'success' ); } ) .catch( () => { showNotice( __( 'An error occurred while sharing your post.', 'jetpack-publicize-pkg' ) ); diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-publicize-share-post.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-publicize-share-post.php index 8d3de953b07d2..f9522d94231e6 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-publicize-share-post.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-publicize-share-post.php @@ -69,6 +69,11 @@ public function register_routes() { return array_map( 'absint', $param ); }, ), + 'async' => array( + 'description' => __( 'Whether to share the post asynchronously.', 'jetpack' ), + 'type' => 'boolean', + 'default' => false, + ), ), ), // override = true because this API route was commandeered from the file diff --git a/projects/plugins/jetpack/changelog/update-social-make-resharing-async-in-classic-editor b/projects/plugins/jetpack/changelog/update-social-make-resharing-async-in-classic-editor new file mode 100644 index 0000000000000..3ce7e8310fb8a --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-social-make-resharing-async-in-classic-editor @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Social | Made resharing async in classic editor to fix timeout issues