106 parent::__construct( $context, $linkRenderer );
108 $this->blockActionInfo = $blockActionInfo;
109 $this->blockRestrictionStore = $blockRestrictionStore;
110 $this->blockUtils = $blockUtils;
111 $this->hideUserUtils = $hideUserUtils;
112 $this->commentStore = $commentStore;
113 $this->linkBatchFactory = $linkBatchFactory;
114 $this->rowCommentFormatter = $rowCommentFormatter;
115 $this->specialPageFactory = $specialPageFactory;
148 if ( $msg ===
null ) {
151 'createaccountblock',
154 'blocklist-nousertalk',
158 'blocklist-editing-sitewide',
159 'blocklist-hidden-param',
162 foreach ( $keys as $key ) {
163 $msg[$key] = $this->
msg( $key )->text();
166 '@phan-var string[] $msg';
179 $formatted = $linkRenderer->makeKnownLink(
180 $this->specialPageFactory->getTitleForAlias(
'BlockList' ),
181 $language->userTimeAndDate( $value, $this->getUser() ),
183 [
'wpTarget' =>
"#{$row->bl_id}" ],
188 $formatted = $this->formatTarget( $row );
192 $formatted = htmlspecialchars( $language->formatExpiry(
200 if ( $row->bt_auto ) {
201 $links[] = $linkRenderer->makeKnownLink(
202 $this->specialPageFactory->getTitleForAlias(
'Unblock' ),
205 [
'wpTarget' =>
"#{$row->bl_id}" ]
208 $target = $row->bt_address ?? $row->bt_user_text;
209 $links[] = $linkRenderer->makeKnownLink(
210 $this->specialPageFactory->getTitleForAlias(
"Unblock/$target" ),
213 $links[] = $linkRenderer->makeKnownLink(
214 $this->specialPageFactory->getTitleForAlias(
"Block/$target" ),
215 $msg[
'change-blocklink']
218 $formatted .=
' ' . Html::rawElement(
220 [
'class' =>
'mw-blocklist-actions' ],
221 $this->
msg(
'parentheses' )->rawParams(
222 $language->pipeList( $links ) )->escaped()
225 if ( $value !==
'infinity' ) {
227 $formatted .=
'<br />' . $this->
msg(
228 'ipb-blocklist-duration-left',
229 $language->formatDurationBetweenTimestamps(
230 (
int)$timestamp->getTimestamp( TS_UNIX ),
239 $formatted = Linker::userLink( (
int)$value, $row->bl_by_text );
240 $formatted .= Linker::userToolLinks( (
int)$value, $row->bl_by_text );
250 if ( $row->bl_deleted ) {
251 $properties[] = htmlspecialchars( $msg[
'blocklist-hidden-param' ] );
253 if ( $row->bl_sitewide ) {
254 $properties[] = htmlspecialchars( $msg[
'blocklist-editing-sitewide'] );
257 if ( !$row->bl_sitewide && $this->restrictions ) {
258 $list = $this->getRestrictionListHTML( $row );
260 $properties[] = htmlspecialchars( $msg[
'blocklist-editing'] ) . $list;
264 if ( $row->bl_anon_only ) {
265 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
267 if ( $row->bl_create_account ) {
268 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
270 if ( $row->bt_user && !$row->bl_enable_autoblock ) {
271 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
274 if ( $row->bl_block_email ) {
275 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
278 if ( !$row->bl_allow_usertalk ) {
279 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
282 $formatted = Html::rawElement(
285 implode(
'', array_map(
static function ( $prop ) {
286 return Html::rawElement(
296 $formatted =
"Unable to format $name";
517 $lb = $this->linkBatchFactory->newLinkBatch();
518 $lb->setCaller( __METHOD__ );
521 foreach ( $result as $row ) {
522 $target = $row->bt_address ?? $row->bt_user_text;
523 if ( $target !==
null ) {
528 if ( isset( $row->bl_by_text ) ) {
529 $lb->add(
NS_USER, $row->bl_by_text );
533 if ( !$row->bl_sitewide ) {
534 $partialBlocks[] = (int)$row->bl_id;
538 if ( $partialBlocks ) {
541 $this->restrictions = $this->blockRestrictionStore->loadByBlockId( $partialBlocks );
543 foreach ( $this->restrictions as $restriction ) {
544 if ( $restriction->getType() === PageRestriction::TYPE ) {
545 '@phan-var PageRestriction $restriction';
546 $title = $restriction->getTitle();
548 $lb->addObj( $title );
558 $this->formattedComments = $this->rowCommentFormatter->formatRows( $result,
'bl_reason' );