← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/initseries-bug-887637 into lp:launchpad

 

Raphaël Badin has proposed merging lp:~rvb/launchpad/initseries-bug-887637 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #887637 in Launchpad itself: "+initseries breaks when packageset widget not displayed"
  https://bugs.launchpad.net/launchpad/+bug/887637

For more details, see:
https://code.launchpad.net/~rvb/launchpad/initseries-bug-887637/+merge/81604

This branch fixes FormActionsWidget.registerWidget so that null widgets are now skipped.

= Tests =

lib/lp/app/javascript/formwidgets/tests/test_formwidgets.html

= Q/A =

Initializing a second-derivation series (i.e. one for which the target distribution has published sources) sound now work (use +initseries to check).
-- 
https://code.launchpad.net/~rvb/launchpad/initseries-bug-887637/+merge/81604
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/initseries-bug-887637 into lp:launchpad.
=== modified file 'lib/lp/app/javascript/formwidgets/formwidgets.js'
--- lib/lp/app/javascript/formwidgets/formwidgets.js	2011-10-17 16:18:31 +0000
+++ lib/lp/app/javascript/formwidgets/formwidgets.js	2011-11-08 16:41:37 +0000
@@ -507,11 +507,14 @@
 
     /**
      * Register a widget as part of this encapsulating widget.
+     * Only register the widget if it is not null.
      *
      * @method registerWidget
      */
     registerWidget: function(widget) {
-        this._widgets.push(widget);
+        if (widget !== null) {
+            this._widgets.push(widget);
+        }
     },
 
     /**

=== modified file 'lib/lp/app/javascript/formwidgets/tests/test_formwidgets.js'
--- lib/lp/app/javascript/formwidgets/tests/test_formwidgets.js	2011-10-17 14:17:53 +0000
+++ lib/lp/app/javascript/formwidgets/tests/test_formwidgets.js	2011-11-08 16:41:37 +0000
@@ -611,6 +611,13 @@
             Assert.areSame(
                 "Fake Widget",
                 this.widget._widgets[length]);
+        },
+
+        testRegisterWidgetNullWidget: function() {
+            var length = this.widget._widgets.length;
+            this.widget.registerWidget(null);
+            Assert.areEqual(
+                length, this.widget._widgets.length);
         }
 
     };