105 parent::__construct( $context, $linkRenderer );
107 $this->blockActionInfo = $blockActionInfo;
108 $this->blockRestrictionStore = $blockRestrictionStore;
109 $this->blockUtils = $blockUtils;
110 $this->hideUserUtils = $hideUserUtils;
111 $this->commentStore = $commentStore;
112 $this->linkBatchFactory = $linkBatchFactory;
113 $this->rowCommentFormatter = $rowCommentFormatter;
114 $this->specialPageFactory = $specialPageFactory;
147 if ( $msg ===
null ) {
150 'createaccountblock',
153 'blocklist-nousertalk',
157 'blocklist-editing-sitewide',
158 'blocklist-hidden-param',
161 foreach ( $keys as $key ) {
162 $msg[$key] = $this->
msg( $key )->text();
165 '@phan-var string[] $msg';
178 $formatted = $linkRenderer->makeKnownLink(
179 $this->specialPageFactory->getTitleForAlias(
'BlockList' ),
180 $language->userTimeAndDate( $value, $this->getUser() ),
182 [
'wpTarget' =>
"#{$row->bl_id}" ],
187 $formatted = $this->formatTarget( $row );
191 $formatted = htmlspecialchars( $language->formatExpiry(
199 if ( $row->bt_auto ) {
200 $links[] = $linkRenderer->makeKnownLink(
201 $this->specialPageFactory->getTitleForAlias(
'Unblock' ),
204 [
'wpTarget' =>
"#{$row->bl_id}" ]
207 $target = $row->bt_address ?? $row->bt_user_text;
208 $links[] = $linkRenderer->makeKnownLink(
209 $this->specialPageFactory->getTitleForAlias(
"Unblock/$target" ),
212 $links[] = $linkRenderer->makeKnownLink(
213 $this->specialPageFactory->getTitleForAlias(
"Block/$target" ),
214 $msg[
'change-blocklink']
217 $formatted .=
' ' . Html::rawElement(
219 [
'class' =>
'mw-blocklist-actions' ],
220 $this->
msg(
'parentheses' )->rawParams(
221 $language->pipeList( $links ) )->escaped()
224 if ( $value !==
'infinity' ) {
226 $formatted .=
'<br />' . $this->
msg(
227 'ipb-blocklist-duration-left',
228 $language->formatDuration(
229 (
int)$timestamp->getTimestamp( TS_UNIX ) - MWTimestamp::time(),
243 $formatted = Linker::userLink( (
int)$value, $row->bl_by_text );
244 $formatted .= Linker::userToolLinks( (
int)$value, $row->bl_by_text );
254 if ( $row->bl_deleted ) {
255 $properties[] = htmlspecialchars( $msg[
'blocklist-hidden-param' ] );
257 if ( $row->bl_sitewide ) {
258 $properties[] = htmlspecialchars( $msg[
'blocklist-editing-sitewide'] );
261 if ( !$row->bl_sitewide && $this->restrictions ) {
262 $list = $this->getRestrictionListHTML( $row );
264 $properties[] = htmlspecialchars( $msg[
'blocklist-editing'] ) . $list;
268 if ( $row->bl_anon_only ) {
269 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
271 if ( $row->bl_create_account ) {
272 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
274 if ( $row->bt_user && !$row->bl_enable_autoblock ) {
275 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
278 if ( $row->bl_block_email ) {
279 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
282 if ( !$row->bl_allow_usertalk ) {
283 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
286 $formatted = Html::rawElement(
289 implode(
'', array_map(
static function ( $prop ) {
290 return Html::rawElement(
300 $formatted =
"Unable to format $name";
521 $lb = $this->linkBatchFactory->newLinkBatch();
522 $lb->setCaller( __METHOD__ );
525 foreach ( $result as $row ) {
526 $target = $row->bt_address ?? $row->bt_user_text;
527 if ( $target !==
null ) {
532 if ( isset( $row->bl_by_text ) ) {
533 $lb->add(
NS_USER, $row->bl_by_text );
537 if ( !$row->bl_sitewide ) {
538 $partialBlocks[] = (int)$row->bl_id;
542 if ( $partialBlocks ) {
545 $this->restrictions = $this->blockRestrictionStore->loadByBlockId( $partialBlocks );
547 foreach ( $this->restrictions as $restriction ) {
548 if ( $restriction->getType() === PageRestriction::TYPE ) {
549 '@phan-var PageRestriction $restriction';
550 $title = $restriction->getTitle();
552 $lb->addObj( $title );
562 $this->formattedComments = $this->rowCommentFormatter->formatRows( $result,
'bl_reason' );