Remove Embargo & Expiry feature from codebase. Add support for external module#389
Conversation
ScopeyNZ
left a comment
There was a problem hiding this comment.
The PHP support question is a good one. I personally feel like we should be able to release a major version of this module after June and set a minimum version of 7.2. That's just my opinion though 🙂
I haven't checked this out locally for testing just given it a quick once over on the code.
|
Thanks, @ScopeyNZ! Sorry that took me forever. This is my first hackday since my hiatus. |
|
Is it worth me picking this up again? The original blocker isn't an issue any more, but I would need to see where I've taken Embargo & Expiry in the last few years to make sure things are still compatible. |
43e5dfd to
c8767a6
Compare
c8767a6 to
db08b33
Compare
91bad6a to
e0d7075
Compare
|
Hi team, This pull request has been updated to match the current state of both modules. I wasn't sure if this should target I would leave it up to you to decide (of course), but I'm guessing this would need to be a new |
The Gist
Remove the Embargo & Expiry feature from code base, and add support for external Embargo & Expiry module.
The Embargo & Expiry module already supports the Fluent module.
WorkflowEmbargoExpiryExtension.phpThe DB fields between Advanced Workflow and Embargo & Expiry match, so they should not require any "migration", so long as devs apply the
EmbargoExpiryExtensionto the same model that previously hadWorkflowEmbargoExpiryExtension.Migration dev task
The DB fields above are fine, but if the site already has some existing jobs from this module, then those will need to be migrated to jobs from the Embargo & Expiry module.
EmbargoExpiryMigrationTaskhas been provided for this.Below are the tests I went though. I started with Workflow's Embargo feature, and I then switched to Embargo & Expiry, ran a
dev/buildplus the above dev task. Below indicates the "state" that the page was in when I switched modules. Each page remained in the desired state after the migration.Before:


After:


How we're doing it
Embargo & Expiry provides an extension point (
preventEmbargoExpiryQueueJobs) which can be used to interrupt to queueing of Jobs when a record is saved.If a
DataObjecthas a Workflow applied, then we want to interrupt Job creation so that we can first go through the approval process. Once the process is completed, and the "Un/Publish" action is triggered, then we can queue the Jobs.PublishItemWorkflowAction.php&UnpublishItemWorkflowAction.phpWhen either of these actions are submitted, we check for the existence of the required
Extensionsas well as anyDesiredembargo/expiry dates. If some are found, then we queue up the appropriate Jobs, rather than publish/unpublish at the time of the actions trigger.Delay action fields
When publishing, if the
Actionhas aPublishDelay, then we will queue up thatPublishDelayas an embargo date. This will override anyDesiredPublishDatethat might have been set.Similar process for unpublishing and the
UnpublishDelay.WorkflowPublishTargetJob.phpRemoved. No longer required as this process is taken care of by Embargo & Expiry module.
WorkflowEmbargoExpiryTest.phpUpdated to only cover the areas that this module is now interested in. Which is to say, that the module now only needs to care that Jobs are correctly created (or not created) when approvals are made.