'cssClassSuffix' => 'watchedunseen',
'isRowApplicableCallable' => function ( $ctx, RecentChange $rc ) {
$changeTs = $rc->getAttribute( 'rc_timestamp' );
- $lastVisitTs = $this->watchStore->getLatestNotificationTimestamp(
- $rc->getAttribute( 'wl_notificationtimestamp' ),
- $rc->getPerformer(),
- $rc->getTitle()
- );
+ $lastVisitTs = $this->getLatestSeenTimestamp( $rc );
+
return $lastVisitTs !== null && $changeTs >= $lastVisitTs;
},
],
'label' => 'rcfilters-filter-watchlistactivity-seen-label',
'description' => 'rcfilters-filter-watchlistactivity-seen-description',
'cssClassSuffix' => 'watchedseen',
- 'isRowApplicableCallable' => function ( $ctx, $rc ) {
+ 'isRowApplicableCallable' => function ( $ctx, RecentChange $rc ) {
$changeTs = $rc->getAttribute( 'rc_timestamp' );
- $lastVisitTs = $rc->getAttribute( 'wl_notificationtimestamp' );
+ $lastVisitTs = $this->getLatestSeenTimestamp( $rc );
+
return $lastVisitTs === null || $changeTs < $lastVisitTs;
}
],
],
'default' => ChangesListStringOptionsFilterGroup::NONE,
- 'queryCallable' => function ( $specialPageClassName, $context, $dbr,
- &$tables, &$fields, &$conds, &$query_options, &$join_conds, $selectedValues ) {
+ 'queryCallable' => function (
+ $specialPageClassName,
+ $context,
+ IDatabase $dbr,
+ &$tables,
+ &$fields,
+ &$conds,
+ &$query_options,
+ &$join_conds,
+ $selectedValues
+ ) {
if ( $selectedValues === [ 'seen' ] ) {
$conds[] = $dbr->makeList( [
'wl_notificationtimestamp IS NULL',
$rc->counter = $counter++;
if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
- $updated = $obj->wl_notificationtimestamp;
+ $lastVisitTs = $this->getLatestSeenTimestamp( $rc );
+ $updated = ( $lastVisitTs > $rc->getAttribute( 'timestamp' ) );
} else {
$updated = false;
}
$count = $store->countWatchedItems( $this->getUser() );
return floor( $count / 2 );
}
+
+ /**
+ * @param RecentChange $rc
+ * @return string TS_MW timestamp
+ */
+ protected function getLatestSeenTimestamp( RecentChange $rc ) {
+ return $this->watchStore->getLatestNotificationTimestamp(
+ $rc->getAttribute( 'wl_notificationtimestamp' ),
+ $rc->getPerformer(),
+ $rc->getTitle()
+ );
+ }
}