/** @var ActorMigration */
private $actorMigration;
+ /** @var WatchedItemStoreInterface */
+ private $watchedItemStore;
+
public function __construct(
LoadBalancer $loadBalancer,
CommentStore $commentStore,
- ActorMigration $actorMigration
+ ActorMigration $actorMigration,
+ WatchedItemStoreInterface $watchedItemStore
) {
$this->loadBalancer = $loadBalancer;
$this->commentStore = $commentStore;
$this->actorMigration = $actorMigration;
+ $this->watchedItemStore = $watchedItemStore;
}
/**
/**
* @return IDatabase
- * @throws MWException
*/
private function getConnection() {
return $this->loadBalancer->getConnectionRef( DB_REPLICA, [ 'watchlist' ] );
break;
}
+ $target = new TitleValue( (int)$row->rc_namespace, $row->rc_title );
$items[] = [
new WatchedItem(
$user,
- new TitleValue( (int)$row->rc_namespace, $row->rc_title ),
- $row->wl_notificationtimestamp
+ $target,
+ $this->watchedItemStore->getLatestNotificationTimestamp(
+ $row->wl_notificationtimestamp, $user, $target
+ )
),
$this->getRecentChangeFieldsFromRow( $row )
];
$watchedItems = [];
foreach ( $res as $row ) {
+ $target = new TitleValue( (int)$row->wl_namespace, $row->wl_title );
// todo these could all be cached at some point?
$watchedItems[] = new WatchedItem(
$user,
- new TitleValue( (int)$row->wl_namespace, $row->wl_title ),
- $row->wl_notificationtimestamp
+ $target,
+ $this->watchedItemStore->getLatestNotificationTimestamp(
+ $row->wl_notificationtimestamp, $user, $target
+ )
);
}
$conds = array_merge( $conds, $this->getStartEndConds( $db, $options ) );
- if ( !isset( $options['start'] ) && !isset( $options['end'] ) ) {
- if ( $db->getType() === 'mysql' ) {
- // This is an index optimization for mysql
- $conds[] = 'rc_timestamp > ' . $db->addQuotes( '' );
- }
+ if ( !isset( $options['start'] ) && !isset( $options['end'] ) && $db->getType() === 'mysql' ) {
+ // This is an index optimization for mysql
+ $conds[] = 'rc_timestamp > ' . $db->addQuotes( '' );
}
$conds = array_merge( $conds, $this->getUserRelatedConds( $db, $user, $options ) );
private function getWatchedItemsWithRCInfoQueryJoinConds( array $options ) {
$joinConds = [
- 'watchlist' => [ 'INNER JOIN',
+ 'watchlist' => [ 'JOIN',
[
'wl_namespace=rc_namespace',
'wl_title=rc_title'