Originally I thought #2927359: Allow scheduling of multiple content entity state transitions at once. was going to address this use case, but reading it again makes me believe it won't. The use case described in the issue title is actually pretty straight forward:

As a content author, I want to create multiple versions of a tournament event page that needs to automatically change on a schedule over the weekend. On Saturday at 8:00 am a version of the page stating that the event will be beginning in a few hours should be automatically published. At noon a new version of the page stating that the event has begun and showing a live video feed should become active. At 5:00 pm yet another version of the same page should be published stating that the event is over. All three versions of the page need to be created during the work week and scheduled to go live at the same URL, just at different times, without manual intervention.

Comments

anavarre created an issue. See original summary.

phenaproxima’s picture

I thought about this today. The good news is, I don't think it would be impossible to implement. The bad news is, it would be really hard.

The devil is in the fact that moderation states are a state machine. This means that, if you're in a given state, the states you can then transition to will vary depending on the state you're currently in.

Now, if you're creating a new chain of scheduled moderation state changes, that's not really a problem. You define one change, then another (which is influenced by whatever the previous state was), and so on. But what if you want to edit such a chain? The only state you can change is the final one, because nothing is coming after it. If you change any of the states in the middle, it invalidates every state that comes after it, since each state depends on the previous one. So, to edit a chain of state transitions, you literally need to remove a whole bunch of them, then recreate them. That's gonna make for some pretty shitty UX.

This is not to mention the fact that such a UI would be very difficult to implement. Lots of AJAXy Form API stuff and other frightening dragons. Not saying it's impossible, just bloody difficult. But I wanted to dump my thoughts here for posterity, and to see if anyone has suggestions for how to proceed here.

TravisCarden’s picture

Thanks for the thoughts, @phenaproxima. This is obviously a thorny problem. If there's sufficient demand for it, however, we may find that there are ways to deliver the business value outside the originally assumed technical constraints. For example, we have assumed thus far that the solution involves multiple revisions on the same node, leading to the chain invalidation problem you refer to (from changing revision ID's, I assume). What if we cloned entire nodes instead and scheduled an event that unpublished the original node, published the new one, and re-pointed the URL alias? That's just one (somewhat hand wavy) example to illustrate the scope of possibilities. Setting aside the originally proposed implementation, then, what do you think of the story from a business perspective?

phenaproxima’s picture

Project: Lightning » Lightning Workflow
Version: 8.x-3.x-dev » 8.x-1.x-dev
Component: Workflow » User interface
balsama’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Active » Needs review

This feature is now available in the 2.x branch of Lightning Workflow. To test:

If you are using the Lightning Profile:

composer require drupal/lightning_workflow:"2.0.0-alpha1 as 1.1.0" --no-update
composer update drupal/lightning_workflow --with-dependencies
drush update:db

If you are using Lightning Workflow as a standalone module:

composer require drupal/lightning_workflow:^2.0 --no-update
composer update drupal/lightning_workflow --with-dependencies

Lightning Workflow 2.0 will automatically migrate your existing scheduled transitions in a database update.

TravisCarden’s picture

@balsama, I'd like to test the new feature, but I'm having trouble. I followed your instructions to upgrade from 1.1.0 to 2.0.0-alpha1, but there were no database updates, and I don't see any differences in the UI. Thoughts?

balsama’s picture

@TravisCarden Thanks for testing! or trying to test at least :)

What was the output of composer update? Do you see lightning_scheduler_update_8001 in "lightning_workflow/modules/lightning_scheduler/lightning_scheduler_install"? Are you using the profile or the standalone module? Is it possible you have a really old version of Composer or have Lightning Scheduler uninstalled?

balsama’s picture

We have fixed a few more bugs in the 2.x branch. So it's best to grab HEAD rather than the alpha1 release mentioned above.

If you are using the Lightning Profile:

composer require drupal/lightning_workflow:"2.x-dev as 1.1.0" --no-update
composer update drupal/lightning_workflow --with-dependencies
drush update:db

If you are using Lightning Workflow as a standalone module:

composer require drupal/lightning_workflow:2.x-dev --no-update
composer update drupal/lightning_workflow --with-dependencies
balsama’s picture

Issue tags: +Release blocker
mikemadison’s picture

Status: Needs review » Reviewed & tested by the community

scheduling multiple transitions on node creation and then executing them via cron as their times expire works fine for me given the current dev branch of lightning _workflow.

phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

This is merged in Lightning Workflow 8.x-2.x, so I'm calling this one fixed.

  • phenaproxima authored 445c5dc on 8.x-2.x
    Add a Drush command for running the Scheduler migration (#26)
    
    Lightning...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.