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.

Before:
Before

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);
         }
       }
     }

After:
After

CommentFileSizeAuthor
After.png38.06 KBsumit saini
Before.png37.36 KBsumit saini
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sumit_saini created an issue. See original summary.

sumit saini’s picture

Assigned: sumit saini » Unassigned
Status: Needs work » Needs review
Issue tags: +Needs Review Queue Initiative

  • adriancid committed 70ec479a on 2.0.x
    Issue #3363107 by sumit_saini, adriancid: previousRevisionDeletionBatch...
adriancid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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