From acd0ce8e4a1af54ac473e4a9132841a7e4667a1c Mon Sep 17 00:00:00 2001 From: petarpetkovic Date: Wed, 6 Dec 2017 16:12:41 +0100 Subject: [PATCH] Add tags for undo edits Follow up on Ie7f637fcec. Bug: T167656 Change-Id: I763844e4bf7c3b5ca7a436cc4aa22a92f70f79d0 --- includes/DefaultSettings.php | 4 +++- includes/changetags/ChangeTags.php | 3 ++- includes/page/WikiPage.php | 5 +++++ languages/i18n/en.json | 2 ++ languages/i18n/qqq.json | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c17bf7e452..2ee27ab143 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6951,6 +6951,7 @@ $wgUseTagFilter = true; * - 'mw-blank': Edit completely blanks the page * - 'mw-replace': Edit removes more than 90% of the content * - 'mw-rollback': Edit is a rollback, made through the rollback link or rollback API + * - 'mw-undo': Edit made through an undo link * * @var array * @since 1.31 @@ -6962,7 +6963,8 @@ $wgSoftwareTags = [ 'mw-changed-redirect-target' => true, 'mw-blank' => true, 'mw-replace' => true, - 'mw-rollback' => true + 'mw-rollback' => true, + 'mw-undo' => true, ]; /** diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index b4a8ca8028..db1f599087 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -39,7 +39,8 @@ class ChangeTags { 'mw-changed-redirect-target', 'mw-blank', 'mw-replace', - 'mw-rollback' + 'mw-rollback', + 'mw-undo', ]; /** diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index ff997ab238..67e4d0d56c 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1624,6 +1624,11 @@ class WikiPage implements Page, IDBAccessObject { $tags[] = $tag; } + // Check for undo tag + if ( $undidRevId !== 0 && in_array( 'mw-undo', ChangeTags::getSoftwareTags() ) ) { + $tags[] = 'mw-undo'; + } + // Provide autosummaries if summary is not provided and autosummaries are enabled if ( $wgUseAutomaticEditSummaries && ( $flags & EDIT_AUTOSUMMARY ) && $summary == '' ) { $summary = $handler->getAutosummary( $old_content, $content, $flags ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 7254b92a54..70230fef73 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3888,6 +3888,8 @@ "tag-mw-replace-description": "Edits that remove more than 90% of the content of a page", "tag-mw-rollback": "Rollback", "tag-mw-rollback-description": "Edits that roll back previous edits using the rollback link", + "tag-mw-undo": "Undo", + "tag-mw-undo-description": "Edits that undo previous edits using the undo link", "tags-title": "Tags", "tags-intro": "This page lists the tags that the software may mark an edit with, and their meaning.", "tags-tag": "Tag name", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 0497396e6c..54b2ee0456 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -4083,6 +4083,8 @@ "tag-mw-replace-description": "Description for \"replace\" change tag", "tag-mw-rollback": "Change tag for rolling back an edit\n{{Identical|Rollback}}", "tag-mw-rollback-description": "Description for \"rollback\" change tag", + "tag-mw-undo": "Change tag for undoing an edit", + "tag-mw-undo-description": "Description for \"undo\" change tag", "tags-title": "The title of [[Special:Tags]].\n{{Identical|Tag}}", "tags-intro": "Explanation on top of [[Special:Tags]]. For more information on tags see [[mw:Manual:Tags|MediaWiki]].", "tags-tag": "Caption of a column in [[Special:Tags]]. For more information on tags see [[mw:Manual:Tags|MediaWiki]].", -- 2.20.1