*/
use MediaWiki\Linker\LinkRenderer;
use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionRecord;
use Wikimedia\Rdbms\IResultWrapper;
class ChangesList extends ContextSource {
$user = $context->getUser();
$sk = $context->getSkin();
$list = null;
- if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list ] ) ) {
+ if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list, $groups ] ) ) {
$new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
return $new ?
public static function revDateLink( Revision $rev, User $user, Language $lang, $title = null ) {
$ts = $rev->getTimestamp();
$date = $lang->userTimeAndDate( $ts, $user );
- if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
+ if ( $rev->userCan( RevisionRecord::DELETED_TEXT, $user ) ) {
$link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
$title ?? $rev->getTitle(),
$date,
} else {
$link = htmlspecialchars( $date );
}
- if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+ if ( $rev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
$link = "<span class=\"history-deleted mw-changeslist-date\">$link</span>";
}
return $link;
public function insertLog( &$s, $title, $logtype ) {
$page = new LogPage( $logtype );
$logname = $page->getName()->setContext( $this->getContext() )->text();
- $s .= $this->msg( 'parentheses' )->rawParams(
- $this->linkRenderer->makeKnownLink( $title, $logname )
- )->escaped();
+ $s .= Html::rawElement( 'span', [
+ 'class' => 'mw-changeslist-links'
+ ], $this->linkRenderer->makeKnownLink( $title, $logname ) );
}
/**
$rc->mAttribs['rc_type'] == RC_CATEGORIZE
) {
$diffLink = $this->message['diff'];
- } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
+ } elseif ( !self::userCan( $rc, RevisionRecord::DELETED_TEXT, $this->getUser() ) ) {
$diffLink = $this->message['diff'];
} else {
$query = [
[ 'class' => 'mw-changeslist-title' ],
$params
);
- if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
+ if ( $this->isDeleted( $rc, RevisionRecord::DELETED_TEXT ) ) {
$articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
}
# To allow for boldening pages watched by this user
* @param RecentChange &$rc
*/
public function insertUserRelatedLinks( &$s, &$rc ) {
- if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
+ if ( $this->isDeleted( $rc, RevisionRecord::DELETED_USER ) ) {
$s .= ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
$formatter->setShowUserToolLinks( true );
$mark = $this->getLanguage()->getDirMark();
- return $formatter->getActionText() . " $mark" . $formatter->getComment();
+ return Html::openElement( 'span', [ 'class' => 'mw-changeslist-log-entry' ] )
+ . $formatter->getActionText() . " $mark" . $formatter->getComment()
+ . Html::closeElement( 'span' );
}
/**
* @return string
*/
public function insertComment( $rc ) {
- if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
+ if ( $this->isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
return ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
} else {
* field of this revision, if it's marked as deleted.
* @param RCCacheEntry|RecentChange $rc
* @param int $field
- * @param User|null $user User object to check, or null to use $wgUser
+ * @param User|null $user User object to check against. If null, the global RequestContext's
+ * User is assumed instead.
* @return bool
*/
public static function userCan( $rc, $field, User $user = null ) {
+ if ( $user === null ) {
+ $user = RequestContext::getMain()->getUser();
+ }
+
if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
- } else {
- return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
}
+
+ return RevisionRecord::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
}
/**
) {
$title = $rc->getTitle();
/** Check for rollback permissions, disallow special pages, and only
- * show a link on the top-most revision */
+ * show a link on the top-most revision
+ */
if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) {
$rev = new Revision( [
'title' => $title,
'actor' => $rc->mAttribs['rc_actor'] ?? null,
'deleted' => $rc->mAttribs['rc_deleted']
] );
- $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
+ $s .= ' ' . Linker::generateRollback( $rev, $this->getContext(),
+ [ 'noBrackets' ] );
}
}
}