Page MenuHomePhabricator

[Page Forms] Special:MultiPageEdit fails to add multiple new rows
Closed, ResolvedPublicBUG REPORT

Description

Environment: MediaWiki 1.44.2, PHP 8.1.33, Page Forms 6.0.3, Cargo 3.8.4

If you try to add multiple rows in the MultiPageEdit form, it writes all data only to the last new row's page.

Steps:

  1. Visit Special:MultiPageEdit page for a template
  2. Click Add Row button twice to insert 2 new rows
  3. Fill out cells for both rows for 2 different pages
  4. Click plus (save) button for the first new row
  5. BUG 1: Inserts the data of row 1, but uses page title of the 2nd new row (verify at Recent Changes in a new tab).
  6. Click plus (save) button for the 2nd new row
  7. BUG 2: Overwrites the previous data by updating page title of row 2 with data of the 2nd new row (verify at Recent Changes in a new tab).
  8. Refresh Special:MultiPageEdit and see only 1 row added

This occurs for any number of new rows. If you add 5 rows, they all save to the 5th row's page and overwrite each other.

You have to instead click Add row, enter data for that row, click + (save) button for that row, then click Add row and repeat for all other new rows, 1 at a time. This makes copy/pasting from an excel sheet impossible, and manually entered data is lost. This could potentially waste user's time going through adding a lot of rows then saving them, to realize they only have 1 actually added with multiple edits with data from all the wrong rows.

Event Timeline

The error also occurs if you add a new row, edit an existing row, then try to save them.

I have determined the issue is in function editMade in PF_spreadsheet.js, ln 599-677. The event listener triggered by the save-new-row button at ln 643 is sending the incorrect page name to saveChanges (ln 132) . variable "page" at ln 654 is not being set correctly.

Change #1202742 had a related patch set uploaded (by TechieNK; author: TechieNK):

[mediawiki/extensions/PageForms@master] Fix: Use correct page name when saving multiple new rows in MultiPageEdit

https://gerrit.wikimedia.org/r/1202742

Change #1202742 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] Correct page name for multi-row save - MultiPageEdit

https://gerrit.wikimedia.org/r/1202742

@TechieNK - thank you for this fix!

@Nickno - thank you for the diagnosis. I believe the problem is fixed now.

Yaron_Koren claimed this task.