Problem/Motivation
Users are using workbench moderation module for managing their publication workflows.
They need to configure which statuses should trigger the upload to Lingotek, and which transitions need to happen just after content translations have been downloaded.
Proposed resolution
In Lingotek content settings, we should be able of configure for each content entity bundle which status of the workbench_moderation workflow needs to trigger the upload. Only in that status, we will upload content if the profile is set up as automatic upload.
Remaining tasks
When content is saved with workbench moderation enabled, but not in the status which we configured for upload, we should prevent the upload.
When content translation is downloaded with workbench moderation enabled, if the status is the source status of the configured transition, execute the transition.
Implements tests for each scenario.
User interface changes
Lingotek content settings will have a new column for configuring the status that triggers the upload and the workbench moderation transition that needs to be executed.
API changes
API additions:
TBD
Data model changes
Settings include workbench moderation settings per bundle.
TBD
Comment | File | Size | Author |
---|---|---|---|
#37 | 2901235-workbench-moderation-integration-36.patch | 74.1 KB | penyaskito |
| |||
#13 | 2901235-workbench-moderation-integration-13.patch | 36.34 KB | penyaskito |
|
Comments
Comment #2
penyaskitoWorked on form settings and storing per bundle.
Defaults in settings are a published status and the first transition from that status to another published status if it exists.
When content is created or updated, we check the workbench moderation settings for uploading if the profile is set as automatic.
Implemented tests
LingotekWorkbenchModerationTest
:\Drupal\lingotek\Tests\LingotekWorkbenchModerationSettingsTest::testWorkbenchModerationSettings
Comment #4
penyaskitoTests failed because of the test dependency on workbench_moderation. Created and fixed #2901247: Workbench moderation integration: add workbench_moderation to test dependencies.
Rebased patch.
Comment #6
penyaskitoForgot to include the submit handler in settings form in the patch.
Added phpdoc to
LingotekWorkbenchModerationConfigurationService
.Comment #8
penyaskitoWe require the dev version of workbench_moderation for the tests, the moderation form doesn't exist in a tagged version.
Comment #10
penyaskitoRe-tested after commiting composer.json that ensures last dev is available.
#2901342: Update composer.json
Comment #11
penyaskitoOnly show settings if the bundle is setup as moderatable.
If not, show a text and link to configure moderation.
If the entity does not support moderation, don't show the column.
Tests covering all those cases.
Comment #13
penyaskitoFixed code standards and solved test failures (workbench moderation needed to be setup before lingotek)
Comment #14
penyaskitoAdded handling of the download, with the transition happening (if the source didn't change meanwhile).
Added test for the transition happening on download, when the source status didn't change.
Added test for the transition not happening on download, when the source status changed.
Comment #15
penyaskitoExtract an interface from
\Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
and createdDrupal\lingotek\Moderation
namespace.Comment #17
penyaskitoCreated another service as workbench moderation handler, for removing as much as possible from the
\Drupal\lingotek\LingotekContentTranslationService
class and thelingotek.module
file.Comment #19
penyaskitoFixed services definition and fixed phpdoc packages.
Comment #21
penyaskitoFixing references to service.
Comment #22
penyaskitoCreated a factory for abstracting the different strategies for content moderation. It works with tagged services for allowing extensibility.
Implemented a noop content moderation strategy for when there is no content moderation module enabled, as it makes easy to remove any dependencies.
Let's see if this magic works.
Comment #24
penyaskitoFixing test failures and code standards.
Comment #25
penyaskitoNope, should use the factory instead.
phpdocs missing
inject services.
Comment #26
penyaskitoAdded factory interface. Cleaned up factory.
Removed references to workbench moderation where there shouldn't be.
Added phpdocs.
Missing still test for the factory and injecting services in some places.
Comment #27
penyaskitoInject services and factory unit tests.
Comment #29
penyaskitoWe cannot inject the workbench_moderation services through the services.yml file, as they may not exist.
Instead let's inject the container and get it in the constructor.
Comment #30
penyaskitoThis and its implementations shouldn't contain Workbench.
Replaced
$entity_id
with$entity_type_id
and$bundle_id
with$bundle
for consistency.Added missing phpdocs.
Comment #32
penyaskitoOops, missed one reference.
Comment #33
penyaskitoAdded check on form submit handler.
Fixing coding standards.
Comment #35
penyaskitoFixed errors.
Comment #37
penyaskitoInclude the from and to states on the transitions, as there may be more than one with same name.
Comment #39
penyaskitoTests passed as expected. McCann reviewed and suggested the last change in the transition labels.
Comment #40
penyaskitoCommitted 4586e89 and pushed to 8.x-2.x. Thanks!