Also fix bug where the "changes since last visit" counter failed to show for pages
where their entire history is still in recent changes. Although the "new" flag is
set for the RCCacheEntry block, there can still be multiple revisions since the
last one seen by the user. This change accounts for that case.
Bug: T218511
Change-Id: I92060bd26d8642937cad7f8c1ace3c5e066790be
$tableClasses[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
}
$tableClasses[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
}
- if ( $block[0]->watched
- && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
- ) {
+ if ( $block[0]->watched ) {
$tableClasses[] = 'mw-changeslist-line-watched';
} else {
$tableClasses[] = 'mw-changeslist-line-not-watched';
$tableClasses[] = 'mw-changeslist-line-watched';
} else {
$tableClasses[] = 'mw-changeslist-line-not-watched';
foreach ( $block as $rcObj ) {
// If all log actions to this page were hidden, then don't
// give the name of the affected page for this block!
foreach ( $block as $rcObj ) {
// If all log actions to this page were hidden, then don't
// give the name of the affected page for this block!
- if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
+ if ( !static::isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
$namehidden = false;
}
$u = $rcObj->userlink;
$namehidden = false;
}
$u = $rcObj->userlink;
} elseif ( $allLogs ) {
$articleLink = $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
} elseif ( $allLogs ) {
$articleLink = $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
- $articleLink = $this->getArticleLink( $block[0], $block[0]->unpatrolled, $block[0]->watched );
+ $articleLink = $this->getArticleLink(
+ $block[0], $block[0]->unpatrolled, $block[0]->watched );
}
$queryParams['curid'] = $curId;
}
$queryParams['curid'] = $curId;
$lineParams = [ 'targetTitle' => $rcObj->getTitle() ];
$classes = [ 'mw-enhanced-rc' ];
$lineParams = [ 'targetTitle' => $rcObj->getTitle() ];
$classes = [ 'mw-enhanced-rc' ];
- if ( $rcObj->watched
- && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
- ) {
+ if ( $rcObj->watched ) {
$classes[] = 'mw-enhanced-watched';
}
$classes = array_merge( $classes, $this->getHTMLClasses( $rcObj, $rcObj->watched ) );
$classes[] = 'mw-enhanced-watched';
}
$classes = array_merge( $classes, $this->getHTMLClasses( $rcObj, $rcObj->watched ) );
- if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
+ if ( static::isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
$link = '<span class="history-deleted">' . $link . '</span> ';
}
}
$link = '<span class="history-deleted">' . $link . '</span> ';
}
}
/**
* Generates amount of changes (linking to diff ) & link to history.
*
/**
* Generates amount of changes (linking to diff ) & link to history.
*
+ * @param RCCacheEntry[] $block
* @param array $queryParams
* @param bool $allLogs
* @param bool $isnew
* @param array $queryParams
* @param bool $allLogs
* @param bool $isnew
/** @var RCCacheEntry $rcObj */
foreach ( $block as $rcObj ) {
// Same logic as below inside main foreach
/** @var RCCacheEntry $rcObj */
foreach ( $block as $rcObj ) {
// Same logic as below inside main foreach
- if ( $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
+ if ( $rcObj->watched ) {
$sinceLast++;
$unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
}
$sinceLast++;
$unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
}
$block0 = $block[0];
$last = $block[count( $block ) - 1];
if ( !$allLogs ) {
$block0 = $block[0];
$last = $block[count( $block ) - 1];
if ( !$allLogs ) {
- if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ||
- $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE
+ $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE ||
+ !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() )
) {
$links['total-changes'] = Html::rawElement( 'span', [], $nchanges[$n] );
} else {
) {
$links['total-changes'] = Html::rawElement( 'span', [], $nchanges[$n] );
} else {
- if ( $sinceLast > 0 && $sinceLast < $n ) {
- $links['total-changes-since-last'] = Html::rawElement( 'span', [],
- $this->linkRenderer->makeKnownLink(
- $block0->getTitle(),
- new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
- [ 'class' => 'mw-changeslist-groupdiff' ],
- $queryParams + [
- 'diff' => $currentRevision,
- 'oldid' => $unvisitedOldid,
- ]
- )
- );
- }
+ }
+
+ if (
+ $rcObj->mAttribs['rc_type'] != RC_CATEGORIZE &&
+ $sinceLast > 0 &&
+ $sinceLast < $n
+ ) {
+ $links['total-changes-since-last'] = Html::rawElement( 'span', [],
+ $this->linkRenderer->makeKnownLink(
+ $block0->getTitle(),
+ new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
+ [ 'class' => 'mw-changeslist-groupdiff' ],
+ $queryParams + [
+ 'diff' => $currentRevision,
+ 'oldid' => $unvisitedOldid,
+ ]
+ )
+ );
$rc->numberofWatchingusers = 0;
}
$rc->numberofWatchingusers = 0;
}
+ // XXX: this treats pages with no unseen changes as "not on the watchlist" since
+ // everything is on the watchlist and it is an easy way to make pages with unseen
+ // changes appear bold. @TODO: clean this up.
$changeLine = $list->recentChangesLine( $rc, $unseen, $counter );
if ( $changeLine !== false ) {
$s .= $changeLine;
$changeLine = $list->recentChangesLine( $rc, $unseen, $counter );
if ( $changeLine !== false ) {
$s .= $changeLine;