Problem/Motivation

Content that is scheduled to be published is actually being unpublished (which is a no-op as they were already unpublished).

Steps to reproduce

When using the scheduler module to schedule content publication, the ModerationOptOutUnpublishNode plugin is executed instead of the ModerationOptOutPublishNode plugin.

Proposed resolution

Fix the typo on the workbench_moderation_action_info_alter implementation.

Remaining tasks

NA

User interface changes

NA

API changes

NA

Data model changes

NA

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dungahk created an issue. See original summary.

dungahk’s picture

Assigned: dungahk » Unassigned
Status: Active » Needs review

I created an issue fork with the fix.

achap’s picture

Status: Needs review » Reviewed & tested by the community

Nice job! This was a hard bug to track down. I'm also using scheduler and the same issue has been affecting me and a few others over in this issue: https://www.drupal.org/project/scheduler/issues/2977887

Your patch fixes it for me.

jonathan1055’s picture

Thanks for finding this typo, it does sound like this is the cause of #2977887: Nodes not publishing after Cron - conflict with Workbench Moderation

Given that this is marked as a major bug, and it was a simple typo problem, would it be good to try to get some test coverage for this scenario?

jonathan1055’s picture

I have done more testing, and confirm that this typo does cause some of the problems observed in #2977887: Nodes not publishing after Cron - conflict with Workbench Moderation.

Because $definitions[entity:publish_action:node] is incorrectly set to ModerationOptOutUnpublishNode, for non-moderated content which is scheduled for publishing, the processing is done by the parent of ModerationOptOutUnpublishNode, which leaves the node unpublished (opposite of what is intended).

The side-effect of incorrectly leaving $definitions[entity:unpublish_action:node] unchanged is less apparent, because for non-moderated content, the original node_unpublish action does the processing, which is just fine. However, if the content is moderated then it is clearly going to do the wrong thing.

There are other problems with Scheduling content which is moderated via workbench_moderation, due to how workbench_moderation_actions does things slightly differently in the actions, and that needs to be solved separately. But getting the $definitions fixed in this issue will be a big step forward.

jonathan1055’s picture

Issue summary: View changes

I have just re-queued the test. If this passes, can the maintainers please commit this? It's been RTBC for four months, and is a clear and obvious typo which can be fixed without any downside. Thanks.