Skip to content

Conversation

@miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Jan 21, 2025

The handling of a post meta with multiple entries doesn't work well. It fails to identify existing entries, adding new values every sync.

This PR changes the strategy by detecting whether the entire group has changed and replacing it. This is also to support multiple entries with equal value, which is allowed.

The protected method also got its name updated to not confuse with core's update_post_meta.

Testing

  1. Distribute a post to a node
  2. Using the Custom Fields UI, add multiple post meta values sharing the same key and save
  3. Confirm they are added to the destination
  4. Edit the post again, delete some items, and add others with equal value
  5. Confirm the distributed post meta matches exactly

Base automatically changed from fix/content-distribution-consecutive-dispatches to trunk January 21, 2025 19:22
@miguelpeixe miguelpeixe self-assigned this Jan 21, 2025
@miguelpeixe miguelpeixe marked this pull request as ready for review January 21, 2025 19:26
@miguelpeixe miguelpeixe requested a review from a team as a code owner January 21, 2025 19:26
@miguelpeixe miguelpeixe requested a review from naxoc January 21, 2025 19:27
Copy link
Member

@naxoc naxoc left a comment

Choose a reason for hiding this comment

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

Yep! And good call on updating the function name. 👍

@miguelpeixe miguelpeixe merged commit c93084d into trunk Jan 22, 2025
4 checks passed
@github-actions
Copy link

Hey @miguelpeixe, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

@miguelpeixe miguelpeixe deleted the fix/content-distribution-multiple-post-meta branch January 22, 2025 12:33
matticbot pushed a commit that referenced this pull request Jan 23, 2025
# [2.5.0-alpha.1](v2.4.0...v2.5.0-alpha.1) (2025-01-23)

### Bug Fixes

* **content-distribution:** block additional UI components ([#197](#197)) ([3f30cdb](3f30cdb))
* **content-distribution:** handling multiple post meta ([#199](#199)) ([c93084d](c93084d))
* **content-distribution:** Improve CSS for blocked editor ([#193](#193)) ([295bdad](295bdad)), closes [#181](#181)
* **content-distribution:** persist site hash ([#186](#186)) ([120b759](120b759))
* **content-distribution:** prevent consecutive dispatches ([#198](#198)) ([2149a62](2149a62))
* **content-distribution:** refactor outgoing post js ([#188](#188)) ([cc08edc](cc08edc))
* **memberships:** remove managed fields on cancel or expire ([#192](#192)) ([67a5cf0](67a5cf0))

### Features

* **content-distribution:** Block the editor for incoming posts ([#181](#181)) ([48b4cae](48b4cae))
* **content-distribution:** confirm dialog for unlinking and relinking posts ([#190](#190)) ([f36bb28](f36bb28))
* **content-distribution:** migrator ([#185](#185)) ([06ec18a](06ec18a))
* **content-distribution:** post status on create ([#189](#189)) ([1ad3e0c](1ad3e0c))
* sync multiple user roles ([#187](#187)) ([9fa833c](9fa833c))
@matticbot
Copy link
Contributor

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

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Feb 3, 2025
# [2.5.0](v2.4.0...v2.5.0) (2025-02-03)

### Bug Fixes

* **content-distribution:** block additional UI components ([#197](#197)) ([3f30cdb](3f30cdb))
* **content-distribution:** handling multiple post meta ([#199](#199)) ([c93084d](c93084d))
* **content-distribution:** Improve CSS for blocked editor ([#193](#193)) ([295bdad](295bdad)), closes [#181](#181)
* **content-distribution:** persist site hash ([#186](#186)) ([120b759](120b759))
* **content-distribution:** prevent consecutive dispatches ([#198](#198)) ([2149a62](2149a62))
* **content-distribution:** refactor outgoing post js ([#188](#188)) ([cc08edc](cc08edc))
* **memberships:** remove managed fields on cancel or expire ([#192](#192)) ([67a5cf0](67a5cf0))

### Features

* **content-distribution:** Block the editor for incoming posts ([#181](#181)) ([48b4cae](48b4cae))
* **content-distribution:** confirm dialog for unlinking and relinking posts ([#190](#190)) ([f36bb28](f36bb28))
* **content-distribution:** migrator ([#185](#185)) ([06ec18a](06ec18a))
* **content-distribution:** post status on create ([#189](#189)) ([1ad3e0c](1ad3e0c))
* sync multiple user roles ([#187](#187)) ([9fa833c](9fa833c))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.5.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.

4 participants