jenkins-bot has submitted this change and it was merged.
Change subject: RC/Watchlist: Filter out parameters that cannot be displayed
......................................................................
RC/Watchlist: Filter out parameters that cannot be displayed
Some parameters added by the ORES extension work with
the URL and the new ERI UI but not with the old toggle
(hide*) filter UI.
Specifying 'msg' => false when adding them from
the hook registers them correctly but they won't
be displayed.
Bug: T149853
Change-Id: If47842f3d91c5999a7c5bf25666b967e9b30a6d7
---
M includes/specialpage/ChangesListSpecialPage.php
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialWatchlist.php
3 files changed, 25 insertions(+), 4 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specialpage/ChangesListSpecialPage.php
b/includes/specialpage/ChangesListSpecialPage.php
index cb13840..9e3e3df 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -495,4 +495,23 @@
protected function getGroupName() {
return 'changes';
}
+
+ /**
+ * Get filters that can be rendered.
+ *
+ * Filters with 'msg' => false can be used to filter data but won't
+ * be presented as show/hide toggles in the UI. They are not returned
+ * by this function.
+ *
+ * @param array $allFilters Map of filter URL param names to properties
(msg/default)
+ * @return array Map of filter URL param names to properties
(msg/default)
+ */
+ protected function getRenderableCustomFilters( $allFilters ) {
+ return array_filter(
+ $allFilters,
+ function( $filter ) {
+ return isset( $filter['msg'] ) && (
$filter['msg'] !== false );
+ }
+ );
+ }
}
diff --git a/includes/specials/SpecialRecentchanges.php
b/includes/specials/SpecialRecentchanges.php
index cd3299c..4569dd2 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -95,7 +95,7 @@
}
/**
- * Get custom show/hide filters
+ * Get all custom filters
*
* @return array Map of filter URL param names to properties
(msg/default)
*/
@@ -747,9 +747,10 @@
$showhide = [ 'show', 'hide' ];
- foreach ( $this->getCustomFilters() as $key => $params ) {
+ foreach ( $this->getRenderableCustomFilters(
$this->getCustomFilters() ) as $key => $params ) {
$filters[$key] = $params['msg'];
}
+
// Disable some if needed
if ( !$user->useRCPatrol() ) {
unset( $filters['hidepatrolled'] );
diff --git a/includes/specials/SpecialWatchlist.php
b/includes/specials/SpecialWatchlist.php
index 4824961..55400d3 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -130,7 +130,7 @@
}
/**
- * Get custom show/hide filters
+ * Get all custom filters
*
* @return array Map of filter URL param names to properties
(msg/default)
*/
@@ -465,9 +465,10 @@
$filters['hidecategorization'] =
'wlshowhidecategorization';
}
- foreach ( $this->getCustomFilters() as $key => $params ) {
+ foreach ( $this->getRenderableCustomFilters(
$this->getCustomFilters() ) as $key => $params ) {
$filters[$key] = $params['msg'];
}
+
// Disable some if needed
if ( !$user->useRCPatrol() ) {
unset( $filters['hidepatrolled'] );
--
To view, visit https://gerrit.wikimedia.org/r/323327
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If47842f3d91c5999a7c5bf25666b967e9b30a6d7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Sbisson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits