Merge "Fix wrong @return type hints in Language::tsTo… methods"
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index 2dda093..15691f2 100644 (file)
@@ -369,10 +369,21 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                }
 
                $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->getParam( 'hidden-cat' )
+                       ) {
+                               continue;
+                       }
+
                        $rc->counter = $counter++;
 
                        if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
@@ -382,7 +393,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        }
 
                        if ( isset( $watchedItemStore ) ) {
-                               $rcTitleValue = new TitleValue( $obj->rc_namespace, $obj->rc_title );
+                               $rcTitleValue = new TitleValue( (int)$obj->rc_namespace, $obj->rc_title );
                                $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue );
                        } else {
                                $rc->numberofWatchingusers = 0;