Ticket #6636 (closed defect: fixed)

Opened 8 months ago

Last modified 8 months ago

Multi-widget data loss

Reported by: mdawaffe Assigned to: mdawaffe
Priority: normal Milestone: 2.5.1
Component: General Version: 2.5
Severity: major Keywords: has-patch needs-testing
Cc:

Description

  1. Add a text widget to your sidebar. Give it a title and some text.
  2. Click "Save Changes".
  3. After the page reload, click "Edit" on that text widget.
  4. Click "Cancel" on that text widget.
  5. Click "Save Changes".
  6. Your text widget has just been emptied of all data.

The same thing happens with our other multi-widgets.

#6291 [7411] caused this regression.

The way widget canceling works, is that the JS disables all the form fields. The widget control callback sees that there is no $_POST data for that widget and skips it. The above change, however, guarantees that there will always be $_POST data for each widget and so "canceled" widgets are not skipped, and so "canceled" widgets are filled with empty data.

The means by which we detect widget canceling is not great; it can be much improved.

The attached, though, corrects the problem with the least code change: before updating the widget, the control function makes a more explicit check to make sure there is the $_POST data for that widget. If not, it will be skipped unless it is a brand new widget (user adds *new* text widget, user clicks "Edit", user clicks "Cancel" user clicks "Save Changes), in which case an empty widget is added.

Attachments

6636.diff (3.7 kB) - added by mdawaffe on 04/07/08 21:16:23.

Change History

04/07/08 21:16:23 changed by mdawaffe

  • attachment 6636.diff added.

04/07/08 21:16:38 changed by mdawaffe

  • keywords set to has-patch needs-testing.
  • owner changed from anonymous to mdawaffe.
  • status changed from new to assigned.

04/07/08 21:40:33 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7620]) Avoid data-loss when editing multi-widgets. Props mdawaffe. fixes #6636 for trunk

04/07/08 21:40:42 changed by ryan

(In [7621]) Avoid data-loss when editing multi-widgets. Props mdawaffe. fixes #6636 for 2.5