Fix undo edit summary when the user who made the old revision is hidden
authorAlex Monk <krenair@gmail.com>
Fri, 17 May 2013 23:31:25 +0000 (00:31 +0100)
committerAlex Monk <krenair@gmail.com>
Sat, 18 May 2013 12:53:45 +0000 (13:53 +0100)
Bug: 48571
Change-Id: I01b034b25032dbbfb67c7f578b501bda746d5335

includes/EditPage.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index 27f4556..bb2bb3c 100644 (file)
@@ -935,7 +935,19 @@ class EditPage {
                                                        # If we just undid one rev, use an autosummary
                                                        $firstrev = $oldrev->getNext();
                                                        if ( $firstrev && $firstrev->getId() == $undo ) {
-                                                               $undoSummary = wfMessage( 'undo-summary', $undo, $undorev->getUserText() )->inContentLanguage()->text();
+                                                               $userText = $undorev->getUserText();
+                                                               if ( $userText === '' ) {
+                                                                       $undoSummary = wfMessage(
+                                                                               'undo-summary-username-hidden',
+                                                                               $undo
+                                                                       )->inContentLanguage()->text();
+                                                               } else {
+                                                                       $undoSummary = wfMessage(
+                                                                               'undo-summary',
+                                                                               $undo,
+                                                                               $userText
+                                                                       )->inContentLanguage()->text();
+                                                               }
                                                                if ( $this->summary === '' ) {
                                                                        $this->summary = $undoSummary;
                                                                } else {
index 4cc00da..0af077c 100644 (file)
@@ -1577,6 +1577,7 @@ Please check the comparison below to verify that this is what you want to do, an
 'undo-failure' => 'The edit could not be undone due to conflicting intermediate edits.',
 'undo-norev'   => 'The edit could not be undone because it does not exist or was deleted.',
 'undo-summary' => 'Undo revision $1 by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]])',
+'undo-summary-username-hidden' => 'Undo revision $1 by a hidden user',
 
 # Account creation failure
 'cantcreateaccounttitle' => 'Cannot create account',
index 5d001bc..04516ea 100644 (file)
@@ -1829,6 +1829,8 @@ See also:
 
 {{Identical|Undo}}',
 'undo-summary' => 'Edit summary for an undo action.{{Identical|Undo}}',
+'undo-summary-username-hidden' => 'Edit summary for an undo action where the username of the old revision is hidden.
+$1 is the revision ID being undone',
 
 # Account creation failure
 'cantcreateaccounttitle' => 'Used as title of the error message {{msg-mw|Cantcreateaccount-text}}.',
index 050b86e..1c3dcba 100644 (file)
@@ -766,6 +766,7 @@ $wgMessageStructure = array(
                'undo-failure',
                'undo-norev',
                'undo-summary',
+               'undo-summary-username-hidden',
        ),
        'cantcreateaccount' => array(
                'cantcreateaccounttitle',