Add tags for undo edits
authorpetarpetkovic <ppetkovic@wikimedia.org>
Wed, 6 Dec 2017 15:12:41 +0000 (16:12 +0100)
committerPetar.petkovic <ppetkovic@wikimedia.org>
Thu, 7 Dec 2017 17:15:28 +0000 (17:15 +0000)
Follow up on Ie7f637fcec.

Bug: T167656
Change-Id: I763844e4bf7c3b5ca7a436cc4aa22a92f70f79d0

includes/DefaultSettings.php
includes/changetags/ChangeTags.php
includes/page/WikiPage.php
languages/i18n/en.json
languages/i18n/qqq.json

index c17bf7e..2ee27ab 100644 (file)
@@ -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,
 ];
 
 /**
index b4a8ca8..db1f599 100644 (file)
@@ -39,7 +39,8 @@ class ChangeTags {
                'mw-changed-redirect-target',
                'mw-blank',
                'mw-replace',
-               'mw-rollback'
+               'mw-rollback',
+               'mw-undo',
        ];
 
        /**
index ff997ab..67e4d0d 100644 (file)
@@ -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 );
index 7254b92..70230fe 100644 (file)
        "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",
index 0497396..54b2ee0 100644 (file)
        "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]].",