Problem/Motivation

Flagging translations as outdated in a pending revision causes multiple translations to be marked as affected.

Proposed resolution

Hidden the "flag as outdated" widget when content is moderated.

Remaining tasks

  • Validate the proposed solution
  • Write a patch
  • Reviews

User interface changes

API changes

None

Data model changes

None

Comments

plach created an issue. See original summary.

plach’s picture

Status: Active » Needs review
StatusFileSize
new9.15 KB

Here's a test-only patch.

plach’s picture

Issue summary: View changes
StatusFileSize
new18.54 KB

And here's the full patch.

plach’s picture

Assigned: plach » Unassigned

The last submitted patch, 2: ct-outdated_pending_revision-2949815-2.test.patch, failed testing. View results

catch’s picture

  1. +++ b/core/modules/content_translation/src/ContentTranslationHandler.php
    @@ -256,6 +264,41 @@ public function retranslate(EntityInterface $entity, $langcode = NULL) {
    +      $metadata = $this->manager->getTranslationMetadata($revision_translation);
    +      if (!$metadata->isOutdated()) {
    +        /** @var \Drupal\Core\Entity\ContentEntityInterface $new_revision */
    +        $new_revision = $storage->createRevision($revision->getTranslation($langcode), $revision->wasDefaultRevision());
    +        $metadata = $this->manager->getTranslationMetadata($new_revision);
    +        $metadata->setOutdated(TRUE);
    +        $storage->save($new_revision);
    +      }
    

    Asked plach about this in slack. Feels like it ought somehow to be possible to mark a translation as outdated without having to create a new revision for each one - this would mean not marking the translations as affected though. Don't think we need to fix that in this issue buy maybe a follow-up to discuss.

  2. +++ b/core/modules/content_translation/src/ContentTranslationManager.php
    @@ -158,8 +164,32 @@ protected function loadContentLanguageSettings($entity_type_id, $bundle) {
    +          $result = TRUE;
    

    Could we early return TRUE instead of the two breaks, and return FALSE at the end? Don't always like early returns, but given there's no logic based on $result it might be slightly more readable. I know this is a temporary function.

    Thought about moving this to content_moderation but since it's @internal and we don't want anyone calling it, putting it in content_moderation for content_translation to call doesn't seem great either.

gábor hojtsy’s picture

I agree with the change in behavior, I don't believe I am qualified to review the implementation itself.

plach’s picture

Issue tags: +Needs followup
StatusFileSize
new1.23 KB
new18.47 KB

Addressed #6.2. I will create a follow-up ASAP.

plach’s picture

Discussed this with @catch: we are not comfortable with committing the latest patch at this stage of the 8.5.0 development. We agreed to hide the "Flag as outdated" widget instead.

effulgentsia’s picture

I committed #2949710: Pending revisions may become unavailable when untranslatable fields affect all translations. #9 has some duplicate hunks from that. Here's a reroll with those removed.

effulgentsia’s picture

Status: Needs review » Reviewed & tested by the community

For #10, I just rebased. The actual work that's in the patch is not mine, but looks great to me. Therefore, RTBC, and removing credit from myself.

gábor hojtsy’s picture

  • Gábor Hojtsy committed 258f544 on 8.6.x
    Issue #2949815 by plach, catch: Flagging translations as outdated in a...

  • Gábor Hojtsy committed ce330db on 8.5.x
    Issue #2949815 by plach, catch: Flagging translations as outdated in a...
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

All right, let's plug this hole. Thanks for producing the fix so fast and for the discussions with @catch et al.

Still needs the followup opened.

gábor hojtsy’s picture

Version: 8.6.x-dev » 8.5.x-dev

Status: Fixed » Closed (fixed)

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