Page MenuHomePhabricator

diff deletes text in edit form in the Page: namespace
Closed, InvalidPublic

Description

Author: Graf.Zahl

Description:
To demonstrate the bug:

  1. Go to e.g.

https://secure.wikimedia.org/wikisource/en/w/index.php?title=Page:Squaring_the_circle.djvu&action=edit

You'll note that the wiki markup is split over three edit forms, header, body and footer.

  1. Press "Show changes"
  1. The text in the first and third edit forms will have vanished (duly noted by the diff).

It seems like the diff function simply ignored the header and footer edit forms. Personally, I would have nothing against getting rid of three-way splitting the markup altogether.


Version: unspecified
Severity: major
URL: https://secure.wikimedia.org/wikisource/en/w/index.php?title=Page:Squaring_the_circle.djvu&action=edit

Details

Reference
bz10679

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:51 PM
bzimport added a project: ProofreadPage.
bzimport set Reference to bz10679.
bzimport added a subscriber: Unknown Object (MLST).

Well, as soon as I press the "Show preview" button, the top and bottom edit boxes are hidden. Their data is automatically added to the middle edit box (the top one is added to the beginning, and the bottom one is added to the end) and everything is fine. I expect the same to happen when I press "Show changes" but it doesn't. It seems like copying relevant parts from the "Show preview" code can fix this bug.

Graf.Zahl wrote:

(In reply to comment #1)

Well, as soon as I press the "Show preview" button, the top and bottom edit
boxes are hidden. Their data is automatically added to the middle edit box (the
top one is added to the beginning, and the bottom one is added to the end) and
everything is fine. I expect the same to happen when I press "Show changes" but
it doesn't. It seems like copying relevant parts from the "Show preview" code
can fix this bug.

Excellent observation! Investigating your theory, I found that the faulty code is not within the extension but in the accompanying JavaScript:

http://wikisource.org/wiki/MediaWiki:Page.js

The relevant code is:

			saveButton = document.getElementById("wpSave"); 
			saveButton.setAttribute("onclick","prpConcat(this.form);");
			previewButton = document.getElementById("wpPreview"); 
			previewButton.setAttribute("onclick","prpConcat(this.form);");

Seems that all that needs to be done is add the following two lines:

diffButton = document.getElementById("wpDiff")
diffButton.setAttribute("onclick","prpConcat(this.form);");

I'll ask ThomasV to do that, he's an admin on oldwikisource.

ayg wrote:

Not an issue with the extension, it's a custom JS bug.

thomasV1 wrote:

Fixed in svn. Actually, the bug was in the extension javascript.

For future reference, please list the revision number in the bug comment when marking things fixed if possible -- makes it easier to find the affected code history. :)