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

CommentFileSizeAuthor
#2 invalid-transition-3195325-2.patch1.02 KBidflood

Comments

idflood created an issue. See original summary.

idflood’s picture

Status: Active » Needs review
StatusFileSize
new1.02 KB

Here 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...

Status: Needs review » Needs work

The last submitted patch, 2: invalid-transition-3195325-2.patch, failed testing. View results

jhedstrom’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Status: Needs work » Needs review
jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests