aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specials/SpecialWatchlist.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialWatchlist.php')
-rw-r--r--includes/specials/SpecialWatchlist.php31
1 files changed, 17 insertions, 14 deletions
diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php
index bac059d2ae2f..812f1b00ab5c 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -199,10 +199,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
'description' => 'rcfilters-filter-watchlistactivity-unseen-description',
'cssClassSuffix' => 'watchedunseen',
'isRowApplicableCallable' => function ( $ctx, RecentChange $rc ) {
- $changeTs = $rc->getAttribute( 'rc_timestamp' );
- $lastVisitTs = $this->getLatestSeenTimestamp( $rc );
-
- return $lastVisitTs !== null && $changeTs >= $lastVisitTs;
+ return !$this->isChangeEffectivelySeen( $rc );
},
],
[
@@ -211,10 +208,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
'description' => 'rcfilters-filter-watchlistactivity-seen-description',
'cssClassSuffix' => 'watchedseen',
'isRowApplicableCallable' => function ( $ctx, RecentChange $rc ) {
- $changeTs = $rc->getAttribute( 'rc_timestamp' );
- $lastVisitTs = $this->getLatestSeenTimestamp( $rc );
-
- return $lastVisitTs === null || $changeTs < $lastVisitTs;
+ return $this->isChangeEffectivelySeen( $rc );
}
],
],
@@ -548,10 +542,9 @@ class SpecialWatchlist extends ChangesListSpecialPage {
$rc->counter = $counter++;
if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
- $lastVisitTs = $this->getLatestSeenTimestamp( $rc );
- $updated = ( $lastVisitTs > $rc->getAttribute( 'timestamp' ) );
+ $unseen = !$this->isChangeEffectivelySeen( $rc );
} else {
- $updated = false;
+ $unseen = false;
}
if ( isset( $watchedItemStore ) ) {
@@ -561,7 +554,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
$rc->numberofWatchingusers = 0;
}
- $changeLine = $list->recentChangesLine( $rc, $updated, $counter );
+ $changeLine = $list->recentChangesLine( $rc, $unseen, $counter );
if ( $changeLine !== false ) {
$s .= $changeLine;
}
@@ -869,9 +862,19 @@ class SpecialWatchlist extends ChangesListSpecialPage {
/**
* @param RecentChange $rc
- * @return string TS_MW timestamp
+ * @return bool User viewed the revision or a newer one
+ */
+ protected function isChangeEffectivelySeen( RecentChange $rc ) {
+ $lastVisitTs = $this->getLatestSeenTimestampIfHasUnseen( $rc );
+
+ return $lastVisitTs === null || $lastVisitTs > $rc->getAttribute( 'rc_timestamp' );
+ }
+
+ /**
+ * @param RecentChange $rc
+ * @return string|null TS_MW timestamp or null if all revision were seen
*/
- protected function getLatestSeenTimestamp( RecentChange $rc ) {
+ private function getLatestSeenTimestampIfHasUnseen( RecentChange $rc ) {
return $this->watchStore->getLatestNotificationTimestamp(
$rc->getAttribute( 'wl_notificationtimestamp' ),
$rc->getPerformer(),