Page MenuHomePhabricator

Special:Upload has a field called "File changes:" that is multi-line but it shouldn't (during a re-upload)
Closed, ResolvedPublic

Description

Issue description

Trying to upload a new version of whatever file on (whatever?) MediaWiki you reach a rude Special:Upload page with a multi-line field called "File changes:".

The issue is that, after pressing "Save", your message is collapsed as a single-line, worsening the readability of the user's message and potentially changing its meaning.

MediaWiki Upload file - file changes pepper.png (1×1 px, 477 KB)

The field "File changes:" is highlighted in the above screenshot (with some green peppers).
You can see it online here: https://commons.wikimedia.org/w/index.php?title=Special:Upload&wpDestFile=Asd.gif&wpForReUpload=1
That URL can be reached from the "Upload a new version of this file" link from whatever page in the File: namespace.

For example if an user inputs this multi-line text:

added a pack of cigarettes

to promote freedom added a sticker

Actually the user saves this single-line edit summary:

added a pack of cigarettes to promote freedom added a sticker

This seems an old UX-Debt affecting whatever MediaWiki file page.

Proposed solution

The proposed solution is to update the Special:Upload page to do not generate anymore this HTML tag when we are in wpForReUpload=1 (re-upload) mode:

<textarea id="wpUploadDescription" cols="80" rows="8" name="wpUploadDescription"></textarea>

But generate something like this instead:

<input type="text" id="wpUploadDescription" name="wpUploadDescription"></textarea>

In this way the user will not be tempted to enter multiple lines, while we do not support newlines in an edit summary.

AFAIK this may be achieved just updating this highlighted block of source code:

https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/specials/forms/UploadForm.php;90996aa040c93e3d0df6e2b640c3dc799df0556d$333-343

Well. It seems a cute good first task.

Happy hacking!

Event Timeline

Change 655429 had a related patch set uploaded (by Diwanshu885; owner: Diwanshu885):
[mediawiki/core@master] Update the HTML tag to remove newlines in edit summary

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

Change 655429 merged by jenkins-bot:
[mediawiki/core@master] Update the HTML tag to remove newlines in edit summary

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

Thanks again to @Diwanshu885 and every reviewer.

I've updated a file in Wikimedia Commons today and I've really appreciated your work.

Cheers!