Page MenuHomePhabricator

Error messages from AbuseFilter shown in UploadWizard and upload dialog are not fully parsed (no templates)
Closed, ResolvedPublic

Description

Error messages from AbuseFilter shown in UploadWizard and upload dialog are not fully parsed (only jqueryMsg, not PHP parser).

Support for templates is critical here, as many of these messages on Commons use {{autotranslate}} to transclude text from the Template namespace – this allows all users to translate them (in the MediaWiki namespace, where messages reside, only sysops can edit).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
matmarex renamed this task from Error messages from AbuseFilter shown in UploadWizard and upload dialog are not fully parsed (only jqueryMsg, not PHP parser) to Error messages from AbuseFilter shown in UploadWizard and upload dialog are not fully parsed (no templates).Aug 30 2016, 4:15 PM

Change 307529 had a related patch set uploaded (by Bartosz Dziewoński):
mw.api.messages: Allow passing extra parameters for the API call

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

Change 307530 had a related patch set uploaded (by Bartosz Dziewoński):
mw.Upload.BookletLayout: Use 'amenableparser' to handle templates in error messages

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

Change 307531 had a related patch set uploaded (by Bartosz Dziewoński):
mw.UploadWizardDetails, mw.UploadWizardUpload: Use 'amenableparser' to handle templates in error messages

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

Example results when attempting to upload a file (

) blocked by filter 153 (cross-wiki) or 156 (UW), before and after the patches above:

[note that you have to test with a newly registered account]

BeforeAfter
UploadWizard
pasted_file (943×1 px, 110 KB)
pasted_file (943×1 px, 183 KB)
Cross-wiki upload dialog
pasted_file (943×1 px, 428 KB)
pasted_file (943×1 px, 441 KB)

Note that this only adds support for templates (and parser functions), and the subset of wikitext that can be parsed is still limited (as evident from the UploadWizard "after" screenshot). Among others, table syntax and embedded images are not supported.

@Steinsplitter Is it necessary for that error message to be wrapped in {{Abusefilter-warning|...}}? Even if I were to implement support for complete wikitext (so basically, parse the message server-side), the current error message (https://commons.wikimedia.org/w/index.php?title=MediaWiki:Abusefilter-warning-copyv2&oldid=205087996) would look silly when inserted into the interface (a quick mockup:

).

@Steinsplitter Is it necessary for that error message to be wrapped in {{Abusefilter-warning|...}}? Even if I were to implement support for complete wikitext (so basically, parse the message server-side), the current error message (https://commons.wikimedia.org/w/index.php?title=MediaWiki:Abusefilter-warning-copyv2&oldid=205087996) would look silly when inserted into the interface (a quick mockup:

).

Thanks for the fix :-).

Regarding the red warning box: It can be removed if needed, no problem.

Change 307529 merged by jenkins-bot:
mw.api.messages: Allow passing extra parameters for the API call

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

Change 307531 merged by jenkins-bot:
mw.UploadWizardDetails, mw.UploadWizardUpload: Use 'amenableparser' to handle templates in error messages

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

Change 307530 merged by jenkins-bot:
mw.Upload.BookletLayout: Use 'amenableparser' to handle templates in error messages

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

I think it would be good to backport those, so that we can tweak the messages on Commons and actually see how they play with the UW and cross-wiki dialog interfaces. I'll schedule a deployment for Monday "European Mid-day SWAT" (https://wikitech.wikimedia.org/wiki/Deployments#deploycal-item-20160905T1300).

Change 308262 had a related patch set uploaded (by Bartosz Dziewoński):
mw.api.messages: Allow passing extra parameters for the API call

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

Change 308267 had a related patch set uploaded (by Bartosz Dziewoński):
mw.UploadWizardDetails, mw.UploadWizardUpload: Use 'amenableparser' to handle templates in error messages

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

Change 308270 had a related patch set uploaded (by Bartosz Dziewoński):
mw.Upload.BookletLayout: Use 'amenableparser' to handle templates in error messages

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

Change 308262 merged by jenkins-bot:
mw.api.messages: Allow passing extra parameters for the API call

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

Change 308270 merged by jenkins-bot:
mw.Upload.BookletLayout: Use 'amenableparser' to handle templates in error messages

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

Change 308267 merged by jenkins-bot:
mw.UploadWizardDetails, mw.UploadWizardUpload: Use 'amenableparser' to handle templates in error messages

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