Watchlist preferences: Disallow zero value for days/limit
authorKosta Harlan <kharlan@wikimedia.org>
Thu, 6 Sep 2018 14:50:08 +0000 (10:50 -0400)
committerKosta Harlan <kharlan@wikimedia.org>
Thu, 6 Sep 2018 17:17:06 +0000 (13:17 -0400)
"0" used to work as an undocumented shortcut for "maximum allowed" days/edits,
but this behavior was removed in If6280ad6fbad65909e1d0b2a48344e24d485aca2

This commit brings the preference options into alignment with how the code
functions.

Bug: T199049
Bug: T176033
Change-Id: I5ffd87565df6b3c602d1f69d9d63621a817ce8cf

includes/preferences/DefaultPreferencesFactory.php

index 07d8b0b..ec85556 100644 (file)
@@ -1123,7 +1123,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
 
                $defaultPreferences['watchlistdays'] = [
                        'type' => 'float',
-                       'min' => 0,
+                       'min' => 1 / 24,
                        'max' => $watchlistdaysMax,
                        'section' => 'watchlist/displaywatchlist',
                        'help' => $context->msg( 'prefs-watchlist-days-max' )->numParams(
@@ -1132,7 +1132,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                ];
                $defaultPreferences['wllimit'] = [
                        'type' => 'int',
-                       'min' => 0,
+                       'min' => 1,
                        'max' => 1000,
                        'label-message' => 'prefs-watchlist-edits',
                        'help' => $context->msg( 'prefs-watchlist-edits-max' )->escaped(),