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

Refactor post_updated and wp_insert_post callbacks #204

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ilicfilip
Copy link
Collaborator

Context

This PR solves the issue we have described in #122 .

While testing after refactoring I found a bug, the refactored method was working fine but the problem was in transition_post_status method which allowed multiple update activities to be added.

I believe that was wrong since in the post_updated method we had a check for not adding update activity if it was already added recently. transition_post_status was missing that check so it allowed user to add activities by simply changing the post status, for example from publish to draft and back from draft to publish.

If I was wrong then only the 2nd commit needs to be reverted.

Quality assurance

  • I have tested this code to the best of my abilities.
  • I have added unit tests to verify the code works as intended.
  • I have checked that the base branch is correctly set.

Fixes #122

Copy link
Contributor

Test on Playground
Test this pull request on the Playground or download the zip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor post_updated and wp_insert_post callbacks
1 participant