105 parent::__construct( $context, $linkRenderer );
106 $this->blockActionInfo = $blockActionInfo;
107 $this->blockRestrictionStore = $blockRestrictionStore;
108 $this->blockUtils = $blockUtils;
109 $this->commentStore = $commentStore;
110 $this->linkBatchFactory = $linkBatchFactory;
111 $this->rowCommentFormatter = $rowCommentFormatter;
112 $this->specialPageFactory = $specialPageFactory;
145 if ( $msg ===
null ) {
148 'createaccountblock',
151 'blocklist-nousertalk',
155 'blocklist-editing-sitewide',
158 foreach (
$keys as $key ) {
159 $msg[$key] = $this->
msg( $key )->text();
162 '@phan-var string[] $msg';
174 case 'ipb_timestamp':
175 $formatted = htmlspecialchars( $language->userTimeAndDate( $value, $this->getUser() ) );
179 if ( $row->ipb_auto ) {
180 $formatted = $this->
msg(
'autoblockid', $row->ipb_id )->parse();
182 list( $target, ) = $this->blockUtils->parseBlockTarget( $row->ipb_address );
184 if ( is_string( $target ) ) {
185 if ( IPUtils::isValidRange( $target ) ) {
188 $formatted = $target;
205 $formatted = htmlspecialchars( $language->formatExpiry(
213 if ( $row->ipb_auto ) {
214 $links[] = $linkRenderer->makeKnownLink(
215 $this->specialPageFactory->getTitleForAlias(
'Unblock' ),
218 [
'wpTarget' =>
"#{$row->ipb_id}" ]
221 $links[] = $linkRenderer->makeKnownLink(
222 $this->specialPageFactory->getTitleForAlias(
'Unblock/' . $row->ipb_address ),
225 $links[] = $linkRenderer->makeKnownLink(
226 $this->specialPageFactory->getTitleForAlias(
'Block/' . $row->ipb_address ),
227 $msg[
'change-blocklink']
230 $formatted .=
' ' . Html::rawElement(
232 [
'class' =>
'mw-blocklist-actions' ],
233 $this->
msg(
'parentheses' )->rawParams(
234 $language->pipeList( $links ) )->escaped()
237 if ( $value !==
'infinity' ) {
239 $formatted .=
'<br />' . $this->
msg(
240 'ipb-blocklist-duration-left',
241 $language->formatDuration(
242 (
int)$timestamp->getTimestamp( TS_UNIX ) - MWTimestamp::time(),
267 if ( $row->ipb_sitewide ) {
268 $properties[] = htmlspecialchars( $msg[
'blocklist-editing-sitewide'] );
271 if ( !$row->ipb_sitewide && $this->restrictions ) {
272 $list = $this->getRestrictionListHTML( $row );
274 $properties[] = htmlspecialchars( $msg[
'blocklist-editing'] ) . $list;
278 if ( $row->ipb_anon_only ) {
279 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
281 if ( $row->ipb_create_account ) {
282 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
284 if ( $row->ipb_user && !$row->ipb_enable_autoblock ) {
285 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
288 if ( $row->ipb_block_email ) {
289 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
292 if ( !$row->ipb_allow_usertalk ) {
293 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
296 $formatted = Html::rawElement(
299 implode(
'', array_map(
static function ( $prop ) {
300 return Html::rawElement(
310 $formatted =
"Unable to format $name";
488 $lb = $this->linkBatchFactory->newLinkBatch();
489 $lb->setCaller( __METHOD__ );
492 foreach ( $result as $row ) {
493 $lb->add(
NS_USER, $row->ipb_address );
496 if ( $row->ipb_by ??
null ) {
497 $lb->add(
NS_USER, $row->ipb_by_text );
501 if ( !$row->ipb_sitewide ) {
502 $partialBlocks[] = $row->ipb_id;
506 if ( $partialBlocks ) {
509 $this->restrictions = $this->blockRestrictionStore->loadByBlockId( $partialBlocks );
511 foreach ( $this->restrictions as $restriction ) {
512 if ( $restriction->getType() === PageRestriction::TYPE ) {
513 '@phan-var PageRestriction $restriction';
514 $title = $restriction->getTitle();
526 $this->formattedComments = $this->rowCommentFormatter->formatRows( $result,
'ipb_reason' );