Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social: Add Social Share Status modal for published posts #39051

Merged
merged 17 commits into from
Aug 29, 2024

Conversation

gmjuhasz
Copy link
Contributor

@gmjuhasz gmjuhasz commented Aug 23, 2024

Fixes https://github.com/Automattic/jetpack-reach/issues/532

Proposed changes:

  • Added new components for the modal
  • Ordered the shares so latest comes first

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

https://github.com/Automattic/jetpack-reach/issues/532

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Add a new post and share it to some platforms
  • In the editor click Sharing status.
  • In the modal you should see the shares and if they failed you should see a button to retry, and an error in the tooltip
  • Reshare the post to some other network
  • Without refreshing the page run await wp.data.dispatch( 'jetpack-social-plugin').invalidateResolution( 'getPostShareStatus', [<POST_ID>] ); which invalidates the store and retrives the shares again
  • The new share should show up in the logs. You might have to wait a bit before issuing this command

Copy link
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!

Copy link
Contributor

github-actions bot commented Aug 23, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the add/social-share-status-shares-modal branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/social-share-status-shares-modal
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/social-share-status-shares-modal
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@gmjuhasz gmjuhasz changed the title Social: Add Social Share Status modal for published posts DRAFT Social: Add Social Share Status modal for published posts Aug 23, 2024
@gmjuhasz gmjuhasz requested a review from a team August 27, 2024 13:27
@gmjuhasz gmjuhasz changed the title DRAFT Social: Add Social Share Status modal for published posts Social: Add Social Share Status modal for published posts Aug 27, 2024
@gmjuhasz gmjuhasz marked this pull request as ready for review August 27, 2024 13:27
Comment on lines 16 to 31
shareStatus.shares = shareStatus.shares.filter( share => {
const hasSuccessfulShareLater = shareStatus.shares.some( otherShare => {
return (
otherShare.timestamp > share.timestamp &&
'success' === otherShare.status &&
otherShare.external_id === share.external_id &&
share.external_id // We added external_id later to the object
);
} );

if ( 'failure' === share.status ) {
return ! hasSuccessfulShareLater;
}

return true;
} );
Copy link
Contributor Author

@gmjuhasz gmjuhasz Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to always show everything this part needs to be changed, or removed.

If we want to hide Retry for those that was already retried, we can update the status here to be retried or something like that.

p1724761254288879/1724758671.904879-slack-C02JJ910CNL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's show the retry button as is and not hide them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let us then leave it as is for now and may be come back later to improve if needed.

I think it does make sense to treat it as activity log.

Copy link
Contributor

@spsiddarthan spsiddarthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will give it a test tomorrow, @gmjuhasz.

We can reinstate the try again button and not hide it conditionally.

I am sure you must have, but would be good to try resharing a post multiple times/have many connections, and ensure the modal is scrollable.

@manzoorwanijk
Copy link
Member

For a single connection, the modal looks too small in height.

image

manzoorwanijk
manzoorwanijk previously approved these changes Aug 28, 2024
Copy link
Member

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works well. I only have that concern about modal height.

@manzoorwanijk manzoorwanijk dismissed their stale review August 28, 2024 14:36

Mobile version needs a fix

@manzoorwanijk
Copy link
Member

Mobile version looks a bit messed up on < 500px

image

Copy link
Member

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can fix the mobile view in another task.

Copy link
Contributor

@spsiddarthan spsiddarthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The happy case works fine.

Screenshot 2024-08-29 at 2 36 15 PM

A few things to address:

  • When a post wasn't shared to any social connections, the review share status button still shows up. To test this publish a post, but don't share it to any connections. Go to the wp-admin's post list screen and visit the edit post view of the same post
  • Let's rename review sharing status to 'View sharing history'. Can do this later as well.
  • Test Mastodon
  • Test LinkedIn - the name of the connection didn't show up in the modal
  • Should we introduce some error handling to prevent editor crashing? Is a try/catch block possible? I am talking about it in the context of this fix - 3c5e987.

* @return {import('react').ReactNode} - React element
*/
export function ShareInfo( { share } ) {
const { service, external_name, profile_picture, timestamp, status, message } = share;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens external_name and profile_picture is undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If external_name is undefined it won't be shown as with the case of linkedIN in your example, I'm not sure why linkedIn has no external name, but we might have to send down another data to fix that if for LinkedIn that's undefined all the time. If there is no profile picture, you get the basic connection icon as with LinkedIn in your case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fallback to the network logo if there is no profile picture?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectionIcon already does that, you can see it on Sid's screenshot for Linkedin

@manzoorwanijk
Copy link
Member

When a post wasn't shared to any social connections, the review share status button still shows up. To test this publish a post, but don't share it to any connections. Go to the wp-admin's post list screen and visit the edit post view of the same post
Let's rename review sharing status to 'View sharing history'. Can do this later as well.

These can be handled in a different task as this one is more about the modal.

Should we introduce some error handling to prevent editor crashing? Is a try/catch block possible? I am talking about it in the context of this fix - 3c5e987.

The place where it erred, we cannot use try/catch

Copy link
Contributor

@spsiddarthan spsiddarthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make the improvements in a follow-up. Sounds good.

@gmjuhasz gmjuhasz merged commit 48ac019 into trunk Aug 29, 2024
73 checks passed
@gmjuhasz gmjuhasz deleted the add/social-share-status-shares-modal branch August 29, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants