X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialEditTags.php;h=48357aa7ad575c82857840dd0baf7f41e074c4f8;hb=d2f799f103d0b576e2e5b1764df449ec3016d3c4;hp=6ef6cb3f7d6971a20cfc867b778c36d950d13fb9;hpb=cb349fb4470cc9e85e688d3784d7b5a5a1df1fd7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialEditTags.php b/includes/specials/SpecialEditTags.php index 6ef6cb3f7d..48357aa7ad 100644 --- a/includes/specials/SpecialEditTags.php +++ b/includes/specials/SpecialEditTags.php @@ -19,6 +19,8 @@ * @ingroup SpecialPage */ +use MediaWiki\Permissions\PermissionManager; + /** * Special page for adding and removing change tags to individual revisions. * A lot of this is copied out of SpecialRevisiondelete. @@ -51,8 +53,18 @@ class SpecialEditTags extends UnlistedSpecialPage { /** @var string */ private $reason; - public function __construct() { + /** @var PermissionManager */ + private $permissionManager; + + /** + * @inheritDoc + * + * @param PermissionManager $permissionManager + */ + public function __construct( PermissionManager $permissionManager ) { parent::__construct( 'EditTags', 'changetags' ); + + $this->permissionManager = $permissionManager; } public function doesWrites() { @@ -67,13 +79,6 @@ class SpecialEditTags extends UnlistedSpecialPage { $user = $this->getUser(); $request = $this->getRequest(); - // Check blocks - // @TODO Use PermissionManager::isBlockedFrom() instead. - $block = $user->getBlock(); - if ( $block ) { - throw new UserBlockedError( $block ); - } - $this->setHeaders(); $this->outputHeader(); @@ -124,7 +129,7 @@ class SpecialEditTags extends UnlistedSpecialPage { $this->ids ); - $this->isAllowed = $user->isAllowed( 'changetags' ); + $this->isAllowed = $this->permissionManager->userHasRight( $user, 'changetags' ); $this->reason = $request->getVal( 'wpReason' ); // We need a target page! @@ -132,6 +137,12 @@ class SpecialEditTags extends UnlistedSpecialPage { $output->addWikiMsg( 'undelete-header' ); return; } + + // Check blocks + if ( $this->permissionManager->isBlockedFrom( $user, $this->targetObj ) ) { + throw new UserBlockedError( $user->getBlock() ); + } + // Give a link to the logs/hist for this page $this->showConvenienceLinks(); @@ -261,8 +272,7 @@ class SpecialEditTags extends UnlistedSpecialPage { // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP // (e.g. emojis) count for two each. This limit is overridden in JS to instead count // Unicode codepoints. - // "- 155" is to leave room for the auto-generated part of the log entry. - 'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT - 155, + 'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT, ] ) . '' . "\n" .