r101666 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101665‎ | r101666 | r101667 >
Date:19:36, 2 November 2011
Author:brion
Status:ok (Comments)
Tags:
Comment:
* (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.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialEditWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialEditWatchlist.php
@@ -388,7 +388,7 @@
389389 : htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) );
390390
391391 $fields['TitlesNs'.$namespace] = array(
392 - 'type' => 'multiselect',
 392+ 'class' => 'EditWatchlistCheckboxSeriesField',
393393 'options' => array(),
394394 'section' => "ns$namespace",
395395 );
@@ -540,3 +540,21 @@
541541 : htmlspecialchars( $this->getContext()->getLang()->getFormattedNsText( $namespace ) );
542542 }
543543 }
 544+
 545+class EditWatchlistCheckboxSeriesField extends HTMLMultiSelectField {
 546+ /**
 547+ * HTMLMultiSelectField throws validation errors if we get input data
 548+ * that doesn't match the data set in the form setup. This causes
 549+ * problems if something gets removed from the watchlist while the
 550+ * form is open (bug 32126), but we know that invalid items will
 551+ * be harmless so we can override it here.
 552+ *
 553+ * @param $value String the value the field was submitted with
 554+ * @param $alldata Array the data collected from the form
 555+ * @return Mixed Bool true on success, or String error to display.
 556+ */
 557+ function validate( $value, $alldata ) {
 558+ // Need to call into grandparent to be a good citizen. :)
 559+ return HTMLFormField::validate( $value, $alldata );
 560+ }
 561+}
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r102534REL1_18 r101540, r101666, r101860, r101990reedy17:10, 9 November 2011
r1025981.18wmf1 MFT r101445, r101464, r101666, r101802, r101860, r101990, r102297, r...reedy23:20, 9 November 2011

Comments

#Comment by Hashar (talk | contribs)   14:43, 3 November 2011

I am not sure I understand the need of a new class there. Cant you use the existing one (HTMLMultiSelectField)?

'class' => 'HTMLMultiSelectField'
#Comment by Brion VIBBER (talk | contribs)   22:05, 3 November 2011

HTMLMultiSelectField is the class that was being used before -- it's not suitable because of its enforced validation as noted in the comment. Hence, the existing HTMLMultiSelectField class is subclassed to override the validation.

#Comment by Hashar (talk | contribs)   10:31, 8 November 2011

Got it! That wachlist editor coupled with HTMLForm made it too smart :-D

Status & tagging log