jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/363394 )
Change subject: Provide parsermigration-edit edit link option for categories
......................................................................
Provide parsermigration-edit edit link option for categories
* Since the high priority categories are being used to effect
Tidy migration, we need editors to be able to compare their fixes
and ensure that the pages look identical after the fix.
* This patch adds a new property for linter categories and displays
the requested edit link in the pager.
* This patch enables the property for high priority categories.
Change-Id: Ia9b23d79da686f0a6c0203e2dba58a876a4a3d4a
---
M extension.json
M includes/CategoryManager.php
M includes/LintErrorsPager.php
3 files changed, 33 insertions(+), 5 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/extension.json b/extension.json
index df372e3..11364b9 100644
--- a/extension.json
+++ b/extension.json
@@ -86,11 +86,13 @@
},
"self-closed-tag": {
"enabled": true,
- "priority": "high"
+ "priority": "high",
+ "parser-migration": true
},
"deletable-table-tag": {
"enabled": true,
- "priority": "high"
+ "priority": "high",
+ "parser-migration": true
},
"misnested-tag": {
"enabled": true,
@@ -98,11 +100,13 @@
},
"pwrap-bug-workaround": {
"enabled": true,
- "priority": "high"
+ "priority": "high",
+ "parser-migration": true
},
"tidy-whitespace-bug": {
"enabled": true,
- "priority": "high"
+ "priority": "high",
+ "parser-migration": true
}
},
"LinterSubmitterWhitelist": {
diff --git a/includes/CategoryManager.php b/includes/CategoryManager.php
index b9faaf4..f3692a5 100644
--- a/includes/CategoryManager.php
+++ b/includes/CategoryManager.php
@@ -57,12 +57,20 @@
self::LOW => [],
];
+ /**
+ * @var string[]
+ */
+ private $parserMigrationCategories = [];
+
public function __construct() {
global $wgLinterCategories;
foreach ( $wgLinterCategories as $name => $info ) {
if ( $info['enabled'] ) {
$this->categories[$info['priority']][] = $name;
}
+ if ( isset( $info['parser-migration'] ) ) {
+ $this->parserMigrationCategories[$name] = true;
+ }
}
sort( $this->categories[self::HIGH] );
@@ -70,6 +78,10 @@
sort( $this->categories[self::LOW] );
}
+ public function needsParserMigrationEdit( $name ) {
+ return isset( $this->parserMigrationCategories[$name] );
+ }
+
/**
* @return string[]
*/
diff --git a/includes/LintErrorsPager.php b/includes/LintErrorsPager.php
index c0c8688..5dc792d 100644
--- a/includes/LintErrorsPager.php
+++ b/includes/LintErrorsPager.php
@@ -20,6 +20,7 @@
namespace MediaWiki\Linter;
+use ExtensionRegistry;
use IContextSource;
use InvalidArgumentException;
use LinkCache;
@@ -31,6 +32,8 @@
use Title;
class LintErrorsPager extends TablePager {
+
+ private $categoryManager;
private $category;
@@ -50,9 +53,11 @@
CategoryManager $catManager, $namespace
) {
$this->category = $category;
+ $this->categoryManager = $catManager;
$this->categoryId = $catManager->getCategoryId( $this->category
);
$this->linkRenderer = $linkRenderer;
$this->namespace = $namespace;
+ $this->haveParserMigrationExt =
ExtensionRegistry::getInstance()->isLoaded( 'ParserMigration' );
parent::__construct( $context );
}
@@ -92,6 +97,13 @@
$row = $this->mCurrentRow;
$row->linter_cat = $this->categoryId;
$lintError = Database::makeLintError( $row );
+ if ( $this->haveParserMigrationExt &&
+ $categoryManager->needsParserMigrationEdit( $name )
+ ) {
+ $editAction = 'parsermigration-edit';
+ } else {
+ $editAction = 'edit';
+ }
switch ( $name ) {
case 'title':
$title = Title::makeTitle(
$row->page_namespace, $row->page_title );
@@ -103,7 +115,7 @@
$title,
$this->msg( 'linker-page-edit'
)->text(),
[],
- [ 'action' => 'edit', 'lintid' =>
$lintError->lintId, ]
+ [ 'action' => $editAction, 'lintid' =>
$lintError->lintId, ]
);
$historyLink = $this->linkRenderer->makeLink(
--
To view, visit https://gerrit.wikimedia.org/r/363394
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia9b23d79da686f0a6c0203e2dba58a876a4a3d4a
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Linter
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits