Problem/Motivation
With translated nodes and revision enabled there are frequent issue with "Invalid transition" validation when changing a node status, even with the main admin account.
Steps to reproduce
Still not sure exactly how to reproduce it with minimal effort but here is a way I reproduced it.
1. enable 2 languages and translation on the page content type
2. create a page as draft in default language
3. translate it in the second language and set it as draft
4. publish the default language page
5. archive the translated version
6. try to publish the translated version.
7. At that point you should get the error "You do not have access to transition from Archived to Published"
Proposed resolution
Use the same logic as the core content_moderation to load the original entity: https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/cont...
The module currently already use the getLoadedRevisionId() to get the $original_entity, one missing thing is that just after it needs to check isDefaultTranslation() and do some magic after that.
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | invalid-transition-3195325-2.patch | 1.02 KB | idflood |
Comments
Comment #2
idflood commentedHere is a minimal patch which resolve the issue. It only adds the isDefaultTranslation() check, but eventually it may be better to copy the whole logic to set $original_entity from https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/cont...
Comment #4
jhedstromComment #5
jhedstrom