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

Feat/network pass #40

Merged
merged 14 commits into from
Feb 21, 2024
Merged

Feat/network pass #40

merged 14 commits into from
Feb 21, 2024

Conversation

leogermani
Copy link
Contributor

@leogermani leogermani commented Feb 5, 2024

Creates the Network pass feature.

Also, this work surfaced a small issue with the plugin. The post_process_in_hub method was being called even for events that were triggered in the Hub itself. This would cause the local memberhips to get the post meta and they would become uneditable.

To be consistent, this method should not be called in such cases. Just as process_in_node is not called in node for their own events.

I slightly changed the architecture there and updated the docs. It should be good now.

** Testing

Setup

  • On site A, create two membership plans
  • In one of the plans, add any value to the new "Network ID" field

image

  • Leave Network ID blank for the other membership plan
  • Do the same on Site B, two memberships
  • In one of the memberships, put the same Network ID

Now let's test the flow

  • Create a new membership for a user in one of the sites - in the memberhips with a Network ID
  • Confirm that a newspack_network_woo_membership_updated is triggered and added to the event log
  • Once this event reaches the other site, confirm the user is created and a membership is granted to them in the membership plan that shares the same network id
  • In the site where the membership was distributed to, confirm the link to edit the membership points to the original site, where the membership was first created
  • Confirm the action links (when you hover the memberhip in the admin table) shows a message "Managed in {link}" with a link to the original membership

image

  • Edit the orginal membership and change its status and confirm all status changes are properly propagated across the network
  • Create a membership in the membership plan without a Network ID and confirm no events are triggered

@leogermani leogermani self-assigned this Feb 5, 2024
@leogermani leogermani marked this pull request as ready for review February 13, 2024 18:57
@leogermani leogermani requested a review from a team as a code owner February 13, 2024 18:57
@leogermani
Copy link
Contributor Author

Thanks @adekbadek ,

I have fixed the link and changed the approach to block edition. I have now a check for the edit_post capability check. See what you think.

Also, this work surfaced a small issue with the plugin. The post_process_in_hub method was being called even for events that were triggered in the Hub itself. This would cause the local memberhips to get the post meta and they would become uneditable.

To be consistent, this method should not be called in such cases. Just as process_in_node is not called in node for their own events.

I slightly changed the architecture there and updated the docs. It should be good now.

(btw, I'm open to revisiting the method names)

leogermani and others added 3 commits February 14, 2024 13:21
# Conflicts:
#	includes/incoming-events/class-order-changed.php
#	includes/incoming-events/class-subscription-changed.php
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Pre-approving, pending some wording suggestions.

includes/woocommerce-memberships/class-admin.php Outdated Show resolved Hide resolved
leogermani and others added 2 commits February 16, 2024 10:15
Co-authored-by: Adam Boro <aborowski24@gmail.com>
Co-authored-by: Adam Boro <aborowski24@gmail.com>
@leogermani
Copy link
Contributor Author

@adekbadek this is good to land. But leaving this un-merged to see how we want to proceed with the release, If we want to have this in an epic branch, a feature flag... or if it's fine since it will have no effect until a Network ID is set

@adekbadek
Copy link
Member

I think we're good to go, just remember to add public-facing docs after the release.

@leogermani leogermani merged commit 71aa872 into trunk Feb 21, 2024
2 of 3 checks passed
@adekbadek adekbadek deleted the feat/network-pass branch February 21, 2024 13:29
@adekbadek adekbadek mentioned this pull request Feb 21, 2024
6 tasks
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.3.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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