From dd092ae5dbb965e9ac0e7e968342a055680d05bc Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 2 Nov 2011 19:36:49 +0000 Subject: [PATCH] * (bug 32126) Fix 1.18 regression in watchlist editor when items already removed from watchlist Overriding validation in HTMLForm bits so the extras can be safely ignored. --- includes/specials/SpecialEditWatchlist.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index e03048ab80..fa16de9ebe 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -388,7 +388,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { : htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) ); $fields['TitlesNs'.$namespace] = array( - 'type' => 'multiselect', + 'class' => 'EditWatchlistCheckboxSeriesField', 'options' => array(), 'section' => "ns$namespace", ); @@ -540,3 +540,21 @@ class EditWatchlistNormalHTMLForm extends HTMLForm { : htmlspecialchars( $this->getContext()->getLang()->getFormattedNsText( $namespace ) ); } } + +class EditWatchlistCheckboxSeriesField extends HTMLMultiSelectField { + /** + * HTMLMultiSelectField throws validation errors if we get input data + * that doesn't match the data set in the form setup. This causes + * problems if something gets removed from the watchlist while the + * form is open (bug 32126), but we know that invalid items will + * be harmless so we can override it here. + * + * @param $value String the value the field was submitted with + * @param $alldata Array the data collected from the form + * @return Mixed Bool true on success, or String error to display. + */ + function validate( $value, $alldata ) { + // Need to call into grandparent to be a good citizen. :) + return HTMLFormField::validate( $value, $alldata ); + } +} \ No newline at end of file -- 2.20.1