Scheduler field not working properly with content moderation / revisioning

Created on 6 October 2022, over 2 years ago
Updated 19 October 2023, over 1 year ago

Problem/Motivation

When using scheduler_field with content_moderation scheduled actions may not fire or may fire incorrectly as the current published revision of the node is processsed by the QueueWorker instead of the forward revision of the node with the proper scheduled field values.

Steps to reproduce

This is a bit complex as you will need a custom action that moderates the node from Draft to Published.

1. Create a content-type with content moderation turned on
2. Add a scheduler field for date published
3. Create a draft node
4. Publish the node
5. Create a new draft of the same node
6. Set the scheduler field field_publish_date to today
7. Run scheduler field cron (ultimate_cron helps)
8. Batch process the scheduler queue (queue_ui helps)

Result: The action never fires because the field items for field_publish_date are empty on your entity because it is looking at the version published in step 4 that has no data for this field.

Proposed resolution

Pass the latest revision to from the QueueWorker.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇦Canada joel_osc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France goz

    Scheduling and revision is a complex thing...

    We should talk about uses cases because i already see issues about basing schedule jobs on revisions.

    1/ Node is published (rev1)
    2/ Revision 2 (rev2) is created unpublished with publication date from 2023-10-19 to 2024-10-19
    3/ Revision 3 (rev3) is created unpublished with publication date from 2023-10-25 to 2024-10-19
    4/ Revision 4 (rev4) is created unpublished with publication date from 2023-10-30 to 2024-10-19

    Only rev1 is published, Revisions 2 to 4 are work in progress.

    How can we know which revisions we can trust and deal with ?

  • 🇨🇦Canada joel_osc

    Agreed, this is really complex. On sites that use moderation we started using this module: https://www.drupal.org/project/scheduled_transitions which works well. Maybe best thing to do would be to put a note on this project stating it that content moderation is not supported? Then this issue can be closed off.

  • 🇫🇷France goz

    In fact, making basic implementation for revision could work for simple cases, which is better than the current state where module does not deal with revisions and content moderation.

    However, if we make such a thing, we'll potentially break other people plugins witch are querying entities, not revisions.

    This is interesting, i don't close this issue yet, let me think about it

Production build 0.71.5 2024