if ( !$user->isAllowed( 'applychangetags' ) ) {
return Status::newFatal( 'tags-apply-no-permission' );
} elseif ( $user->isBlocked() ) {
- return Status::newFatal( 'tags-apply-blocked' );
+ return Status::newFatal( 'tags-apply-blocked', $user->getName() );
}
}
if ( !$user->isAllowed( 'changetags' ) ) {
return Status::newFatal( 'tags-update-no-permission' );
} elseif ( $user->isBlocked() ) {
- return Status::newFatal( 'tags-update-blocked' );
+ return Status::newFatal( 'tags-update-blocked', $user->getName() );
}
}
* @param string $selected Tag to select by default
* @param bool $ooui Use an OOUI TextInputWidget as selector instead of a non-OOUI input field
* You need to call OutputPage::enableOOUI() yourself.
+ * @param IContextSource|null $context
+ * @note Even though it takes null as a valid argument, an IContextSource is preferred
+ * in a new code, as the null value can change in the future
* @return array an array of (label, selector)
*/
- public static function buildTagFilterSelector( $selected = '', $ooui = false ) {
- global $wgUseTagFilter;
+ public static function buildTagFilterSelector(
+ $selected = '', $ooui = false, IContextSource $context = null
+ ) {
+ if ( !$context ) {
+ $context = RequestContext::getMain();
+ }
- if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) {
+ $config = $context->getConfig();
+ if ( !$config->get( 'UseTagFilter' ) || !count( self::listDefinedTags() ) ) {
return [];
}
Html::rawElement(
'label',
[ 'for' => 'tagfilter' ],
- wfMessage( 'tag-filter' )->parse()
+ $context->msg( 'tag-filter' )->parse()
)
];
if ( !$user->isAllowed( 'managechangetags' ) ) {
return Status::newFatal( 'tags-manage-no-permission' );
} elseif ( $user->isBlocked() ) {
- return Status::newFatal( 'tags-manage-blocked' );
+ return Status::newFatal( 'tags-manage-blocked', $user->getName() );
}
}
if ( !$user->isAllowed( 'managechangetags' ) ) {
return Status::newFatal( 'tags-manage-no-permission' );
} elseif ( $user->isBlocked() ) {
- return Status::newFatal( 'tags-manage-blocked' );
+ return Status::newFatal( 'tags-manage-blocked', $user->getName() );
}
}
if ( !$user->isAllowed( 'managechangetags' ) ) {
return Status::newFatal( 'tags-manage-no-permission' );
} elseif ( $user->isBlocked() ) {
- return Status::newFatal( 'tags-manage-blocked' );
+ return Status::newFatal( 'tags-manage-blocked', $user->getName() );
}
}
if ( !$user->isAllowed( 'deletechangetags' ) ) {
return Status::newFatal( 'tags-delete-no-permission' );
} elseif ( $user->isBlocked() ) {
- return Status::newFatal( 'tags-manage-blocked' );
+ return Status::newFatal( 'tags-manage-blocked', $user->getName() );
}
}