/** @var callable */
protected $changeLinePrefixer;
- /** @var BagOStuff */
+ /** @var MapCacheLRU */
protected $watchMsgCache;
/**
protected $filterGroups;
/**
- * Changeslist constructor
- *
* @param Skin|IContextSource $obj
* @param array $filterGroups Array of ChangesListFilterGroup objects (currently optional)
*/
$this->skin = $obj;
}
$this->preCacheMessages();
- $this->watchMsgCache = new HashBagOStuff( [ 'maxKeys' => 50 ] );
+ $this->watchMsgCache = new MapCacheLRU( 50 );
$this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
$this->filterGroups = $filterGroups;
}
$this->rcCacheIndex = 0;
$this->lastdate = '';
$this->rclistOpen = false;
- $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+ $this->getOutput()->addModuleStyles( [
+ 'mediawiki.interface.helpers.styles',
+ 'mediawiki.special.changeslist'
+ ] );
return '<div class="mw-changeslist">';
}
} else {
$formattedSizeClass = 'mw-plusminus-neg';
}
+ $formattedSizeClass .= ' mw-diff-bytes';
$formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
return Html::element( $tag,
[ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
- $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
+ $formattedSize ) . $lang->getDirMark();
}
/**
);
}
if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
- $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
+ $histLink = $this->message['hist'];
} else {
- $diffhist = $diffLink . $this->message['pipe-separator'];
- # History link
- $diffhist .= $this->linkRenderer->makeKnownLink(
+ $histLink = $this->linkRenderer->makeKnownLink(
$rc->getTitle(),
new HtmlArmor( $this->message['hist'] ),
[ 'class' => 'mw-changeslist-history' ],
);
}
- // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
- $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
- ' <span class="mw-changeslist-separator">. .</span> ';
- }
-
- /**
- * @param string &$s Article link will be appended to this string, in place.
- * @param RecentChange $rc
- * @param bool $unpatrolled
- * @param bool $watched
- * @deprecated since 1.27, use getArticleLink instead.
- */
- public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
- $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
+ $s .= Html::rawElement( 'div', [ 'class' => 'mw-changeslist-links' ],
+ Html::rawElement( 'span', [], $diffLink ) .
+ Html::rawElement( 'span', [], $histLink )
+ ) .
+ ' <span class="mw-changeslist-separator"></span> ';
}
/**
public function getTimestamp( $rc ) {
// @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
- $this->getLanguage()->userTime(
+ htmlspecialchars( $this->getLanguage()->userTime(
$rc->mAttribs['rc_timestamp'],
$this->getUser()
- ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
+ ) ) . '</span> <span class="mw-changeslist-separator"></span> ';
}
/**
} else {
$s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
$rc->mAttribs['rc_user_text'] );
- $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+ $s .= Linker::userToolLinks(
+ $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'],
+ false, 0, null,
+ // The text content of tools is not wrapped with parenthesises or "piped".
+ // This will be handled in CSS (T205581).
+ false
+ );
}
}
if ( $count <= 0 ) {
return '';
}
- $cache = $this->watchMsgCache;
- return $cache->getWithSetCallback(
- $cache->makeKey( 'watching-users-msg', $count ),
- $cache::TTL_INDEFINITE,
+
+ return $this->watchMsgCache->getWithSetCallback(
+ "watching-users-msg:$count",
function () use ( $count ) {
return $this->msg( 'number_of_watching_users_RCview' )
->numParams( $count )->escaped();