Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index d59b66b..6defc9d 100644 (file)
@@ -37,12 +37,16 @@ class SpecialWatchlist extends ChangesListSpecialPage {
        protected static $limitPreferenceName = 'wllimit';
        protected static $collapsedPreferenceName = 'rcfilters-wl-collapsed';
 
+       /** @var float|int */
        private $maxDays;
+       /** WatchedItemStore */
+       private $watchStore;
 
        public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
                parent::__construct( $page, $restriction );
 
                $this->maxDays = $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 );
+               $this->watchStore = MediaWikiServices::getInstance()->getWatchedItemStore();
        }
 
        public function doesWrites() {
@@ -63,6 +67,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $this->addHelpLink( 'Help:Watching pages' );
                $output->addModuleStyles( [ 'mediawiki.special' ] );
                $output->addModules( [
+                       'mediawiki.special.recentchanges',
                        'mediawiki.special.watchlist',
                ] );
 
@@ -186,9 +191,13 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                                        'label' => 'rcfilters-filter-watchlistactivity-unseen-label',
                                        'description' => 'rcfilters-filter-watchlistactivity-unseen-description',
                                        'cssClassSuffix' => 'watchedunseen',
-                                       'isRowApplicableCallable' => function ( $ctx, $rc ) {
+                                       'isRowApplicableCallable' => function ( $ctx, RecentChange $rc ) {
                                                $changeTs = $rc->getAttribute( 'rc_timestamp' );
-                                               $lastVisitTs = $rc->getAttribute( 'wl_notificationtimestamp' );
+                                               $lastVisitTs = $this->watchStore->getLatestNotificationTimestamp(
+                                                       $rc->getAttribute( 'wl_notificationtimestamp' ),
+                                                       $rc->getPerformer(),
+                                                       $rc->getTitle()
+                                               );
                                                return $lastVisitTs !== null && $changeTs >= $lastVisitTs;
                                        },
                                ],
@@ -655,14 +664,15 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                                'class' => 'namespaceselector',
                        ]
                ) . "\n";
-               $namespaceForm .= '<span class="mw-input-with-label">' . Xml::checkLabel(
+               $hidden = $opts['namespace'] === '' ? ' mw-input-hidden' : '';
+               $namespaceForm .= '<span class="mw-input-with-label' . $hidden . '">' . Xml::checkLabel(
                        $this->msg( 'invert' )->text(),
                        'invert',
                        'nsinvert',
                        $opts['invert'],
                        [ 'title' => $this->msg( 'tooltip-invert' )->text() ]
                ) . "</span>\n";
-               $namespaceForm .= '<span class="mw-input-with-label">' . Xml::checkLabel(
+               $namespaceForm .= '<span class="mw-input-with-label' . $hidden . '">' . Xml::checkLabel(
                        $this->msg( 'namespace_association' )->text(),
                        'associated',
                        'nsassociated',