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 | Enable connections management for WPCOM sites #41019

Merged

Conversation

manzoorwanijk
Copy link
Member

@manzoorwanijk manzoorwanijk commented Jan 14, 2025

Related to 168243-ghe-Automattic/wpcom

Proposed changes:

  • Enable connections management feature on WPCOM

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

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

Testing instructions:

  • Use the below matrix to conduct these tests
  • Apply 168243-ghe-Automattic/wpcom to your sandbox
  • Apply this branch to your sandbox while being on the above wpcom branch, instead of on trunk
    • bin/jetpack-downloader test jetpack update/social/enable-connections-management-for-wpcom
  • Point the public API to your sandbox
  • Test the following on Jetpack, Simple and Atomic sites
  • Point the site to your sandbox
  • Goto connections management on Jetpack and Social admin page
  • Confirm that the connections load fine
  • Confirm the same in the editor
  • Add/remove a connection
  • Confirm that it works as expected
  • Mark/unmark a connection as shared
  • Confirm that it works fine
  • Reload the page
  • Confirm that the changes are retained.
  • Test the above as an author account
  • Verify that you are able to see the "Disconnect" button
  • Verify that the author is not able see the "Disconnect" button for shared connections
  • Break a few connections
    • For Mastodon, remove Jetpack here.
    • For Facebook, remove Jetpack here.
  • Verify that broken connections are marked as such in the connections manage and in the editor notices
Jetpack plugin Social Plugin Block editor ✅ Classic editor ✅
Jetpack and Atomic sites
This branch This branch
This branch Latest release
Latest release This branch
This branch v4.x.x
v13.x.x This branch
Simple sites
Block editor ✅ Classic editor ✅

Sorry, something went wrong.

manzoorwanijk and others added 15 commits January 7, 2025 10:31

Unverified

No user is associated with the committer email.
* Create connections class for caching

* Update script data to use connections from the REST endpoint

* changelog

* Restore deprecated connection fields for time being

* Disable caching for now

* Fix display_name for Mastodon

* Remove the unused caching logic
* Social: Use connections REST endpoint for initial state (#40677)

* Create connections class for caching

* Update script data to use connections from the REST endpoint

* changelog

* Restore deprecated connection fields for time being

* Disable caching for now

* Fix display_name for Mastodon

* Remove the unused caching logic

* Update connect-form.tsx

* Create connections class for caching

* Update types for connection object

* Update connection actions to reflect new types

* Mark 'id' as deprecated

* Add changelog

* Deprecated fields should be optional

* Fix TS error

* Update unit tests

* Replace/remove deprecated props usage

* Remove unused code

* Fix connection selectors

* Fix unit tests

* Reduce the number of changes

* Fix type

* Oops! It should be negation

* Restore class-connections.php
* Allow requests as blog in base controller

* Add filters for connections controller

* Add changelog

* Update baseline.php

* Rename the 'include' param to 'scope' for clarity

* Return shared connections by default

* Remove scope parameter in favour of request context

* Only pass test_connections to WPCOM

* Update baseline.php
* Update connections class to implement caching

* Add get_all_for_user method

* Pass cached connections to initial state

* Invalidate cache on XMLRPC request

* Add changelog

* Remove eager loading of connections following cache invalidation

* Improve clear caching logic to handle race condition
* Pass the connected users WPCOM data to the UI

* Augment wpcom for user object

* Create canUserManageConnection selector

* Replace can_disconnect with the new selector

* Fix unit tests

* Add changelog

* Fix user data for WPCOM sites

* Fix unit tests

* Add changelog
* Add "must_reauth" to status in REST schema

* Restore the UI changes to consider must_reauth status

* Add changelog

* Don't disable connections with must_reauth status

must_reauth means that the connection will break soon, but it still
works. We'll display an appropriate notice.

---------

Co-authored-by: Paul Bunkham <[email protected]>
…0982)

* Create Proxy_Requests class for re-usability

* Move is_wpcom utility to Publicize_Utils class

* Move connections specific logic from REST controller to connections class

* Add changelog

* Update baseline.php

* Move publicize permissions check to its own method
Copy link
Contributor

github-actions bot commented Jan 14, 2025

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for February 4, 2025 (scheduled code freeze on February 4, 2025).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Social plugin:

  • Next scheduled release: none scheduled.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jan 14, 2025
@manzoorwanijk manzoorwanijk added [Type] Task and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jan 14, 2025
@manzoorwanijk manzoorwanijk self-assigned this Jan 14, 2025
…reen (#40997)

* Social | Fix connected accounts not marked as such on confirmation screen

* Add a comment
…_id` (#41025)

* Social | Update connections schema to change user_id to wpcom_user_id

* Fix wpcom_user_id for post connections field

* Add changelog
@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch from b0b31cd to e221b4f Compare January 14, 2025 12:10
@manzoorwanijk manzoorwanijk changed the base branch from trunk to add/social/rest-crud-endpoints January 14, 2025 12:10
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Jan 14, 2025
* WIP

* Pass the connection ID in the URL

* Pass connection_id for delete proxy request

* Allow overriding $request_options

* Clean up debugging

* Add changelog

* Add changelog for js changes

* Fix static analysis issues

* Remove unused code

* Update baseline.php

---------

Co-authored-by: Paul Bunkham <[email protected]>
@manzoorwanijk
Copy link
Member Author

With this branch on Jetpack and the latest release of Social, and the changes sandboxed, I seem to be able to get an error when trying to connect to LinkedIn

I set up a JN site with exactly the same configuration, but it works fine.

  • Jetpack on PR branch
  • Social on latest release - v6
  • Changes sandboxed (You can see the top bar in the screenshot)

image

@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch from c0bc061 to a63cdd7 Compare January 16, 2025 09:13
@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch from a63cdd7 to 059a69d Compare January 16, 2025 11:57
@pablinos
Copy link
Contributor

It must have been something wrong with the JN site. I can still get the error on there but I can get it working on other test sites.

I've just noticed that we're rendering profile images when they're missing. We used to have something to prevent that

CleanShot 2025-01-16 at 17 23 43@2x

It might not be related to this branch, so we could handle it in a follow up, but it would nice not to have the problem as we launch it.

@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch from 059a69d to c38d3ac Compare January 17, 2025 06:20
@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch 2 times, most recently from 5f9388c to 963f885 Compare January 17, 2025 06:55
@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch from 963f885 to 70fc868 Compare January 17, 2025 11:26
@manzoorwanijk manzoorwanijk force-pushed the update/social/enable-connections-management-for-wpcom branch from 70fc868 to 1b01b2c Compare January 20, 2025 11:04
Base automatically changed from social/unified-connections-management to trunk January 21, 2025 02:55
@github-actions github-actions bot added [JS Package] Script Data [Plugin] Social Issues about the Jetpack Social plugin labels Jan 21, 2025
@manzoorwanijk manzoorwanijk marked this pull request as ready for review January 21, 2025 07:28
@manzoorwanijk manzoorwanijk merged commit 9bdc90a into trunk Jan 22, 2025
59 checks passed
@manzoorwanijk manzoorwanijk deleted the update/social/enable-connections-management-for-wpcom branch January 22, 2025 05:12
coder-karen pushed a commit that referenced this pull request Jan 24, 2025
* Social: Use connections REST endpoint for initial state (#40677)

* Create connections class for caching

* Update script data to use connections from the REST endpoint

* changelog

* Restore deprecated connection fields for time being

* Disable caching for now

* Fix display_name for Mastodon

* Remove the unused caching logic

* Social: Connections API schema front end changes (#40539)

* Social: Use connections REST endpoint for initial state (#40677)

* Create connections class for caching

* Update script data to use connections from the REST endpoint

* changelog

* Restore deprecated connection fields for time being

* Disable caching for now

* Fix display_name for Mastodon

* Remove the unused caching logic

* Update connect-form.tsx

* Create connections class for caching

* Update types for connection object

* Update connection actions to reflect new types

* Mark 'id' as deprecated

* Add changelog

* Deprecated fields should be optional

* Fix TS error

* Update unit tests

* Replace/remove deprecated props usage

* Remove unused code

* Fix connection selectors

* Fix unit tests

* Reduce the number of changes

* Fix type

* Oops! It should be negation

* Restore class-connections.php

* Social | Add site context for publicize endpoints (#40704)

* Allow requests as blog in base controller

* Add filters for connections controller

* Add changelog

* Update baseline.php

* Rename the 'include' param to 'scope' for clarity

* Return shared connections by default

* Remove scope parameter in favour of request context

* Only pass test_connections to WPCOM

* Update baseline.php

* Social: Implement connections caching with the updated endpoint (#40892)

* Update connections class to implement caching

* Add get_all_for_user method

* Pass cached connections to initial state

* Invalidate cache on XMLRPC request

* Add changelog

* Remove eager loading of connections following cache invalidation

* Improve clear caching logic to handle race condition

* Social: Replace can_disconnect with a store data selector (#40888)

* Pass the connected users WPCOM data to the UI

* Augment wpcom for user object

* Create canUserManageConnection selector

* Replace can_disconnect with the new selector

* Fix unit tests

* Add changelog

* Fix user data for WPCOM sites

* Fix unit tests

* Add changelog

* Social | Restore must_reauth as connection status (#40946)

* Add "must_reauth" to status in REST schema

* Restore the UI changes to consider must_reauth status

* Add changelog

* Don't disable connections with must_reauth status

must_reauth means that the connection will break soon, but it still
works. We'll display an appropriate notice.

---------

Co-authored-by: Paul Bunkham <[email protected]>

* Social | Clean up connections controller to use connections class (#40982)

* Create Proxy_Requests class for re-usability

* Move is_wpcom utility to Publicize_Utils class

* Move connections specific logic from REST controller to connections class

* Add changelog

* Update baseline.php

* Move publicize permissions check to its own method

* Social | Fix connect button for broken connections (#40995)

* Social | Fix connected accounts not marked as such on confirmation screen (#40997)

* Social | Fix connected accounts not marked as such on confirmation screen

* Add a comment

* Social | Update connections schema to change `user_id` to `wpcom_user_id` (#41025)

* Social | Update connections schema to change user_id to wpcom_user_id

* Fix wpcom_user_id for post connections field

* Add changelog

* Social | Implement the other CRUD operations for connections (#40928)

* WIP

* Pass the connection ID in the URL

* Pass connection_id for delete proxy request

* Allow overriding $request_options

* Clean up debugging

* Add changelog

* Add changelog for js changes

* Fix static analysis issues

* Remove unused code

* Update baseline.php

---------

Co-authored-by: Paul Bunkham <[email protected]>

* Unify changelogs

* Unify js changelog

* It should be 'blog' not 'site'

* Social | Use the proxy trait from connection package (#41087)

* Update baseline.php

* Update phan

* Social | Fix social connections list initial state feature check (#41151)

* Social | Enable connections management for WPCOM sites

---------

Co-authored-by: Paul Bunkham <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Publicize Now Jetpack Social, auto-sharing [JS Package] Publicize Components [JS Package] Script Data [Package] Publicize [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Wpcomsh RNA [Tests] Includes Tests [Type] Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants