X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FPreferences.php;h=b428e87be4d4831dddbe749604f42f282659a30c;hb=09c69c329ff5dc54d6524a9a52bae6ca7b316969;hp=263ff5b128a3c204b5cebc33ed22a0ed284e96cc;hpb=6f19bac69546b8a5cc06f91a81e364bf905dee7f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Preferences.php b/includes/Preferences.php index 263ff5b128..b428e87be4 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -55,8 +55,6 @@ class Preferences { /** @var array */ protected static $saveFilters = [ 'timecorrection' => [ 'Preferences', 'filterTimezoneInput' ], - 'cols' => [ 'Preferences', 'filterIntval' ], - 'rows' => [ 'Preferences', 'filterIntval' ], 'rclimit' => [ 'Preferences', 'filterIntval' ], 'wllimit' => [ 'Preferences', 'filterIntval' ], 'searchlimit' => [ 'Preferences', 'filterIntval' ], @@ -122,7 +120,7 @@ class Preferences { } } - # # Make sure that form fields have their parent set. See bug 41337. + # # Make sure that form fields have their parent set. See T43337. $dummyForm = new HTMLForm( [], $context ); $disable = !$user->isAllowed( 'editmyoptions' ); @@ -224,24 +222,48 @@ class Preferences { 'section' => 'personal/info', ]; + $lang = $context->getLanguage(); + # Get groups to which the user belongs $userEffectiveGroups = $user->getEffectiveGroups(); - $userGroups = $userMembers = []; + $userGroupMemberships = $user->getGroupMemberships(); + $userGroups = $userMembers = $userTempGroups = $userTempMembers = []; foreach ( $userEffectiveGroups as $ueg ) { if ( $ueg == '*' ) { // Skip the default * group, seems useless here continue; } - $groupName = User::getGroupName( $ueg ); - $userGroups[] = User::makeGroupLinkHTML( $ueg, $groupName ); - $memberName = User::getGroupMember( $ueg, $userName ); - $userMembers[] = User::makeGroupLinkHTML( $ueg, $memberName ); - } - asort( $userGroups ); - asort( $userMembers ); + if ( isset( $userGroupMemberships[$ueg] ) ) { + $groupStringOrObject = $userGroupMemberships[$ueg]; + } else { + $groupStringOrObject = $ueg; + } - $lang = $context->getLanguage(); + $userG = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html' ); + $userM = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html', + $userName ); + + // Store expiring groups separately, so we can place them before non-expiring + // groups in the list. This is to avoid the ambiguity of something like + // "administrator, bureaucrat (until X date)" -- users might wonder whether the + // expiry date applies to both groups, or just the last one + if ( $groupStringOrObject instanceof UserGroupMembership && + $groupStringOrObject->getExpiry() + ) { + $userTempGroups[] = $userG; + $userTempMembers[] = $userM; + } else { + $userGroups[] = $userG; + $userMembers[] = $userM; + } + } + sort( $userGroups ); + sort( $userMembers ); + sort( $userTempGroups ); + sort( $userTempMembers ); + $userGroups = array_merge( $userTempGroups, $userGroups ); + $userMembers = array_merge( $userTempMembers, $userMembers ); $defaultPreferences['usergroups'] = [ 'type' => 'info', @@ -495,9 +517,9 @@ class Preferences { } else { $disableEmailPrefs = true; $emailauthenticated = $context->msg( 'emailnotauthenticated' )->parse() . '
' . - Linker::linkKnown( + $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( 'Confirmemail' ), - $context->msg( 'emailconfirmlink' )->escaped() + $context->msg( 'emailconfirmlink' )->text() ) . '
'; $emailauthenticationclass = "mw-email-not-authenticated"; } @@ -817,20 +839,7 @@ class Preferences { ] ]; } - $defaultPreferences['cols'] = [ - 'type' => 'int', - 'label-message' => 'columns', - 'section' => 'editing/editor', - 'min' => 4, - 'max' => 1000, - ]; - $defaultPreferences['rows'] = [ - 'type' => 'int', - 'label-message' => 'rows', - 'section' => 'editing/editor', - 'min' => 4, - 'max' => 1000, - ]; + if ( $user->isAllowed( 'minoredit' ) ) { $defaultPreferences['minordefault'] = [ 'type' => 'toggle', @@ -838,6 +847,7 @@ class Preferences { 'label-message' => 'tog-minordefault', ]; } + $defaultPreferences['forceeditsummary'] = [ 'type' => 'toggle', 'section' => 'editing/editor', @@ -956,11 +966,12 @@ class Preferences { 'raw' => [ 'EditWatchlist', 'raw' ], 'clear' => [ 'EditWatchlist', 'clear' ], ]; + $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); foreach ( $editWatchlistModes as $editWatchlistMode => $mode ) { // Messages: prefs-editwatchlist-edit, prefs-editwatchlist-raw, prefs-editwatchlist-clear - $editWatchlistLinks[] = Linker::linkKnown( + $editWatchlistLinks[] = $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( $mode[0], $mode[1] ), - $context->msg( "prefs-editwatchlist-{$editWatchlistMode}" )->parse() + new HtmlArmor( $context->msg( "prefs-editwatchlist-{$editWatchlistMode}" )->parse() ) ); } @@ -1190,8 +1201,7 @@ class Preferences { if ( $dateopts ) { if ( !in_array( 'default', $dateopts ) ) { - $dateopts[] = 'default'; // Make sure default is always valid - // Bug 19237 + $dateopts[] = 'default'; // Make sure default is always valid T21237 } // FIXME KLUGE: site default might not be valid for user language