diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2023-03-17 18:55:45 +0100 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2023-05-01 14:43:18 +0200 |
commit | c5864e92d992dd5220cd759eada88fec935a2bc4 (patch) | |
tree | b0534e0a7e7b64d6afbbccb9a8a971663e972868 /includes/preferences | |
parent | e6e567be3333020a7f23a999b3d2f57896b9e739 (diff) | |
download | mediawikicore-c5864e92d992dd5220cd759eada88fec935a2bc4.tar.gz mediawikicore-c5864e92d992dd5220cd759eada88fec935a2bc4.zip |
preferences: Simplify handling of watch preferences for actions
The items in the list $watchTypes are checked with User::isAllowed,
no need to do that before adding to the list.
Except the watchcreations, where more userrights are checked.
Move delete action to the end of the list
Change-Id: Ic0db2708f845bed7d83d720c1ce4a00ee40b63b3
Diffstat (limited to 'includes/preferences')
-rw-r--r-- | includes/preferences/DefaultPreferencesFactory.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php index ec64f6590fa4..7a7e87404842 100644 --- a/includes/preferences/DefaultPreferencesFactory.php +++ b/includes/preferences/DefaultPreferencesFactory.php @@ -1400,7 +1400,6 @@ class DefaultPreferencesFactory implements PreferencesFactory { $watchTypes = [ 'edit' => 'watchdefault', 'move' => 'watchmoves', - 'delete' => 'watchdeletion' ]; // Kinda hacky @@ -1408,13 +1407,12 @@ class DefaultPreferencesFactory implements PreferencesFactory { $watchTypes['read'] = 'watchcreations'; } - if ( $user->isAllowed( 'rollback' ) ) { - $watchTypes['rollback'] = 'watchrollback'; - } - - if ( $user->isAllowed( 'upload' ) ) { - $watchTypes['upload'] = 'watchuploads'; - } + // Move uncommon actions to end of list + $watchTypes += [ + 'rollback' => 'watchrollback', + 'upload' => 'watchuploads', + 'delete' => 'watchdeletion', + ]; foreach ( $watchTypes as $action => $pref ) { if ( $user->isAllowed( $action ) ) { |