Page MenuHomePhabricator

Preserve reference data when creating a new reference and switching the main template
Closed, ResolvedPublic

Description

  1. Go to https://pt.wikipedia.org/w/index.php?title=West_Glamorgan&action=edit
  2. Run ProveIt by copying the code for the Portuguese version of ProveIt into the browser console (or import into your common.js)
  3. Click on "ProveIt"
  4. Click on "Add"
  5. Type something into "Reference name" and "Reference content"
  6. Choose some template in the next field.

Actual result
The text typed on step 5 is deleted.

Expected result
The text typed on step 5 is kept as is.

Event Timeline

Iniquity triaged this task as Medium priority.Oct 25 2016, 10:50 AM
Sophivorus subscribed.

I have pinned down the cause of this bug. When ProveIt scans the wikitext to construct the reference list, it creates a Reference object for each reference, so when one of these references is being edited and the user changes the main template, the reference data is still in the background and the reference form can be regenerated with that data. But when a user is creating a new reference, there is no Reference object in the background yet, so when the user changes the main template, the form is regenerated and there is no Reference object from where to fill it. The solution would be creating a Reference object for the new references too.

Sophivorus renamed this task from ProveIt removes reference name/content when users chooses the main template to Preserve reference data when creating a new reference and switching the main template.Oct 25 2016, 6:23 PM
Sophivorus moved this task from Backlog to Feature requests on the ProveIt-Gadget board.

Change 345739 merged by Sophivorus:
[wikipedia/gadgets/ProveIt@master] Keep data when switching templates on a new reference

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