From: jenkins-bot Date: Fri, 25 Aug 2017 19:56:52 +0000 (+0000) Subject: Merge "WLFilters: Fix seen/unseen filters" X-Git-Tag: 1.31.0-rc.0~2297 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=5bb2ceb7e9678bbe0f202dd05f857007b6101f8e;hp=-c;p=lhc%2Fweb%2Fwiklou.git Merge "WLFilters: Fix seen/unseen filters" --- 5bb2ceb7e9678bbe0f202dd05f857007b6101f8e diff --combined includes/specials/SpecialWatchlist.php index effd7745f5,a17f118c1c..cecc182f72 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@@ -157,7 -157,7 +157,7 @@@ class SpecialWatchlist extends ChangesL 'isRowApplicableCallable' => function ( $ctx, $rc ) { $changeTs = $rc->getAttribute( 'rc_timestamp' ); $lastVisitTs = $rc->getAttribute( 'wl_notificationtimestamp' ); - return $changeTs >= $lastVisitTs; + return $lastVisitTs !== null && $changeTs >= $lastVisitTs; }, ], [ @@@ -168,7 -168,7 +168,7 @@@ 'isRowApplicableCallable' => function ( $ctx, $rc ) { $changeTs = $rc->getAttribute( 'rc_timestamp' ); $lastVisitTs = $rc->getAttribute( 'wl_notificationtimestamp' ); - return $changeTs < $lastVisitTs; + return $lastVisitTs === null || $changeTs < $lastVisitTs; } ], ], @@@ -176,9 -176,15 +176,15 @@@ 'queryCallable' => function ( $specialPageClassName, $context, $dbr, &$tables, &$fields, &$conds, &$query_options, &$join_conds, $selectedValues ) { if ( $selectedValues === [ 'seen' ] ) { - $conds[] = 'rc_timestamp < wl_notificationtimestamp'; + $conds[] = $dbr->makeList( [ + 'wl_notificationtimestamp IS NULL', + 'rc_timestamp < wl_notificationtimestamp' + ], LIST_OR ); } elseif ( $selectedValues === [ 'unseen' ] ) { - $conds[] = 'rc_timestamp >= wl_notificationtimestamp'; + $conds[] = $dbr->makeList( [ + 'wl_notificationtimestamp IS NOT NULL', + 'rc_timestamp >= wl_notificationtimestamp' + ], LIST_AND ); } } ] ) ); @@@ -336,9 -342,7 +342,7 @@@ $user = $this->getUser(); # Toggle watchlist content (all recent edits or just the latest) - if ( $opts['extended'] ) { - $usePage = false; - } else { + if ( !$opts['extended'] ) { # Top log Ids for a page are not stored $nonRevisionTypes = [ RC_LOG ]; Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] ); @@@ -351,7 -355,6 +355,6 @@@ LIST_OR ); } - $usePage = true; } $tables = array_merge( [ 'recentchanges', 'watchlist' ], $tables ); @@@ -375,18 -378,11 +378,11 @@@ $join_conds ); - if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) { - $fields[] = 'wl_notificationtimestamp'; - } + $tables[] = 'page'; + $fields[] = 'page_latest'; + $join_conds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ]; - $rollbacker = $user->isAllowed( 'rollback' ); - if ( $usePage || $rollbacker ) { - $tables[] = 'page'; - $join_conds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ]; - if ( $rollbacker ) { - $fields[] = 'page_latest'; - } - } + $fields[] = 'wl_notificationtimestamp'; // Log entries with DELETED_ACTION must not show up unless the user has // the necessary rights. @@@ -415,10 -411,6 +411,10 @@@ $this->runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts ); + if ( $this->areFiltersInConflict() ) { + return false; + } + return $dbr->select( $tables, $fields,