Addshore has uploaded a new change for review.
https://gerrit.wikimedia.org/r/274081
Change subject: Hide hiddencat catwatch changes in special changelists
......................................................................
Hide hiddencat catwatch changes in special changelists
If a hidden category has a member added or removed
this will only be shown to users that have the user
preference "display hidden categories".
Bug: T127944
Change-Id: I12ec3f317ca6e36f1db8a4b2bdd1c3f210e3e075
---
M includes/changes/RecentChange.php
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialWatchlist.php
3 files changed, 27 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/81/274081/1
diff --git a/includes/changes/RecentChange.php
b/includes/changes/RecentChange.php
index 2c95928..298989a 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -819,6 +819,10 @@
$ip = '',
$deleted = 0
) {
+ $isHiddenCat = WikiPage::factory( $categoryTitle )
+ ->getContent()
+ ->matchMagicWord( MagicWord::get( 'hiddencat' ) );
+
$rc = new RecentChange;
$rc->mTitle = $categoryTitle;
$rc->mPerformer = $user;
@@ -845,7 +849,7 @@
'rc_logid' => 0,
'rc_log_type' => null,
'rc_log_action' => '',
- 'rc_params' => ''
+ 'rc_params' => serialize( [ 'hidden-cat' =>
$isHiddenCat ] ),
];
$rc->mExtra = [
diff --git a/includes/specials/SpecialRecentchanges.php
b/includes/specials/SpecialRecentchanges.php
index 7719505..5dfe15e 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -325,12 +325,23 @@
$list = ChangesList::newFromContext( $this->getContext() );
$list->initChangesListRows( $rows );
+ $userShowHiddenCats = $this->getUser()->getBoolOption(
'showhiddencats' );
$rclistOutput = $list->beginRecentChangesList();
foreach ( $rows as $obj ) {
if ( $limit == 0 ) {
break;
}
$rc = RecentChange::newFromRow( $obj );
+
+ # Skip CatWatch entries for hidden cats based on user
preference
+ if (
+ $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE
&&
+ !$userShowHiddenCats &&
+ $rc->parseParams()['hidden-cat']
+ ) {
+ continue;
+ }
+
$rc->counter = $counter++;
# Check if the page has been updated since the last
visit
if ( $this->getConfig()->get( 'ShowUpdatedMarker' )
diff --git a/includes/specials/SpecialWatchlist.php
b/includes/specials/SpecialWatchlist.php
index dffc9d9..e4899c9 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -363,10 +363,21 @@
$dbr->dataSeek( $rows, 0 );
$s = $list->beginRecentChangesList();
+ $userShowHiddenCats = $this->getUser()->getBoolOption(
'showhiddencats' );
$counter = 1;
foreach ( $rows as $obj ) {
# Make RC entry
$rc = RecentChange::newFromRow( $obj );
+
+ # Skip CatWatch entries for hidden cats based on user
preference
+ if (
+ $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE
&&
+ !$userShowHiddenCats &&
+ $rc->parseParams()['hidden-cat']
+ ) {
+ continue;
+ }
+
$rc->counter = $counter++;
if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
--
To view, visit https://gerrit.wikimedia.org/r/274081
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12ec3f317ca6e36f1db8a4b2bdd1c3f210e3e075
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits