X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserrights.php;h=40f02a5f4dddc8ea2ab228c5d6803ec98b2f343e;hb=043a36858bcb9e2085d2cec95dc816f3770fbb48;hp=a5f9ab3ec1c2f9d70d6f0bc9d22d07465b0695d3;hpb=d0a8e6b9b30272ec216a8a2ceda3b7fc60db1e7a;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php
index a5f9ab3ec1..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,
+ ] ) .
" |
@@ -761,7 +768,7 @@ class UserrightsPage extends SpecialPage {
/**
* Adds a table with checkboxes where you can select what groups to add/remove
*
- * @param array $usergroups Associative array of (group name as string =>
+ * @param UserGroupMembership[] $usergroups Associative array of (group name as string =>
* UserGroupMembership object) for groups the user belongs to
* @param User $user
* @return Array with 2 elements: the XHTML table element with checkxboes, and
@@ -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,