Fix undo edit summary when the user who made the old revision is hidden

Bug: 48571
Change-Id: I01b034b25032dbbfb67c7f578b501bda746d5335
This commit is contained in:
Alex Monk 2013-05-18 00:31:25 +01:00
parent 266e46a5ca
commit 3d104f3fd0
4 changed files with 17 additions and 1 deletions

View 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 {

View 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',

View 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}}.',

View file

@ -766,6 +766,7 @@ $wgMessageStructure = array(
'undo-failure',
'undo-norev',
'undo-summary',
'undo-summary-username-hidden',
),
'cantcreateaccount' => array(
'cantcreateaccounttitle',