X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserrights.php;h=40f02a5f4dddc8ea2ab228c5d6803ec98b2f343e;hp=fd066ac7f3e872c2c796e5f2cbe1d7d6a0d4cddf;hb=a2c8c2969420a0f150c03f76e3a0bf9028fcda43;hpb=1a40e0cc86b6ee0706606ded3ea243dfde4a414c diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index fd066ac7f3..40f02a5f4d 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -716,6 +716,8 @@ class UserrightsPage extends SpecialPage { ->rawParams( $userToolLinks )->parse() ); if ( $canChangeAny ) { + $conf = $this->getConfig(); + $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; $this->getOutput()->addHTML( $this->msg( 'userrights-groups-help', $user->getName() )->parse() . $grouplist . @@ -726,8 +728,13 @@ class UserrightsPage extends SpecialPage { Xml::label( $this->msg( 'userrights-reason' )->text(), 'wpReason' ) . " " . - Xml::input( 'user-reason', 60, $this->getRequest()->getVal( 'user-reason', false ), - [ 'id' => 'wpReason', 'maxlength' => 255 ] ) . + Xml::input( 'user-reason', 60, $this->getRequest()->getVal( 'user-reason', false ), [ + 'id' => 'wpReason', + // 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 (or 255 UTF-8 bytes for old schema). + 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT, + ] ) . " @@ -873,6 +880,10 @@ class UserrightsPage extends SpecialPage { } else { $expiryHtml = $this->msg( 'userrights-expiry-none' )->text(); } + // T171345: Add a hidden form element so that other groups can still be manipulated, + // otherwise saving errors out with an invalid expiry time for this group. + $expiryHtml .= Html::Hidden( "wpExpiry-$group", + $currentExpiry ? 'existing' : 'infinite' ); $expiryHtml .= "
\n"; } else { $expiryHtml = Xml::element( 'span', null,