previousRevisionDeletionBatch shows wrong title and langcode for deleted revision of translated node

Created on 27 May 2023, over 1 year ago
Updated 21 March 2024, 6 months ago

Problem/Motivation

Drupal\node_revision_delete\NodeRevisionDeleteBatch::previousRevisionDeletionBatch() shows wrong node title and langcode for deleted revision of translated node in the batch process message. This is because correct $revision object is not returned by Drupal\node_revision_delete\NodeRevisionDelete::getPreviousRevisions().

Steps to reproduce

1. Create some revisions of a node's translation.
2. Delete translation's revision alongwith selecting "Delete prior revisions" on revision delete page.
3. Notice that the batch process message shows node title and langcode based on default langcode instead of current translation's langcode.


Proposed resolution

Drupal\node_revision_delete\NodeRevisionDelete::getPreviousRevisions() should return $revision object as per node's translation language.

@@ -97,7 +97,7 @@ class NodeRevisionDelete implements NodeRevisionDeleteInterface {
         // Only show revisions that are affected by the language
         // that is being displayed.
         if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {        
-          $revisions_before[] = $revision;
+          $revisions_before[] = $revision->getTranslation($langcode);
         }
       }
     }


🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India sumit_saini

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024