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->formatDurationBetweenTimestamps(
229 (
int)$timestamp->getTimestamp( TS_UNIX ),
238 $formatted = Linker::userLink( (
int)$value, $row->bl_by_text );
239 $formatted .= Linker::userToolLinks( (
int)$value, $row->bl_by_text );
249 if ( $row->bl_deleted ) {
250 $properties[] = htmlspecialchars( $msg[
'blocklist-hidden-param' ] );
252 if ( $row->bl_sitewide ) {
253 $properties[] = htmlspecialchars( $msg[
'blocklist-editing-sitewide'] );
256 if ( !$row->bl_sitewide && $this->restrictions ) {
257 $list = $this->getRestrictionListHTML( $row );
259 $properties[] = htmlspecialchars( $msg[
'blocklist-editing'] ) . $list;
263 if ( $row->bl_anon_only ) {
264 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
266 if ( $row->bl_create_account ) {
267 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
269 if ( $row->bt_user && !$row->bl_enable_autoblock ) {
270 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
273 if ( $row->bl_block_email ) {
274 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
277 if ( !$row->bl_allow_usertalk ) {
278 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
281 $formatted = Html::rawElement(
284 implode(
'', array_map(
static function ( $prop ) {
285 return Html::rawElement(
295 $formatted =
"Unable to format $name";
516 $lb = $this->linkBatchFactory->newLinkBatch();
517 $lb->setCaller( __METHOD__ );
520 foreach ( $result as $row ) {
521 $target = $row->bt_address ?? $row->bt_user_text;
522 if ( $target !==
null ) {
527 if ( isset( $row->bl_by_text ) ) {
528 $lb->add(
NS_USER, $row->bl_by_text );
532 if ( !$row->bl_sitewide ) {
533 $partialBlocks[] = (int)$row->bl_id;
537 if ( $partialBlocks ) {
540 $this->restrictions = $this->blockRestrictionStore->loadByBlockId( $partialBlocks );
542 foreach ( $this->restrictions as $restriction ) {
543 if ( $restriction->getType() === PageRestriction::TYPE ) {
544 '@phan-var PageRestriction $restriction';
545 $title = $restriction->getTitle();
547 $lb->addObj( $title );
557 $this->formattedComments = $this->rowCommentFormatter->formatRows( $result,
'bl_reason' );