Page MenuHomePhabricator

Prevent citoid from being enabled unless all required keys are present in MediaWiki:Citoid-template-type-map.json
Closed, ResolvedPublic1 Estimated Story Points

Description

In a review of citoid installations (https://www.mediawiki.org/wiki/Citoid/Where_citoid_is_enabled), it has come to my attention that hu wiki was enabled with only *one* key present and all the others missing. We should prevent this programmatically, as this has basically trained hu users for more than 3 years that citoid doesn't work :(. This is also not the only instance, ta wiki also was broken (only two keys, and neither had template data, but for a few months) and it has happened in the past too.

Or maybe it would be better if we could hook into the message somehow and provide feedback there, and just prevent users from saving unless it has all the required keys?

It also would be good to provide feedback if a template being inserted either has no template data or no maps value at all. We considered this before and ended up using a generic message but I think telling the users and sending them to a place to report the issue might be good.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Mvolz triaged this task as High priority.Feb 1 2018, 10:37 PM

Change 408344 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/Citoid@master] [POC] Don't show the Cite tool if the config lacks key parts

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

^^^ This proof of concept checks on init for the map having journalArticle, webpage, and book defined (just a stab in the dark as to which we should insist upon). It doesn't check the given templates for valid template data, though. Thoughts?

Validating the JSON on save via PHP is a bit harder so I did this easy one first. ;-)

^^^ This proof of concept checks on init for the map having journalArticle, webpage, and book defined (just a stab in the dark as to which we should insist upon). It doesn't check the given templates for valid template data, though. Thoughts?

Validating the JSON on save via PHP is a bit harder so I did this easy one first. ;-)

I'm inclined to make all the keys required. There's really no reason not to leave one out in the config; you can use all the same template, and even if the template fits badly it's better than having no template at all.

For the missing template data, I'm not sure what the correct approach is; perhaps instead of the generic "we could not make a citation" message for you, perhaps let the user know, and link to the template, since unlike the config message this is potentially something more likely to be editable?

Change 408344 merged by jenkins-bot:
[mediawiki/extensions/Citoid@master] Don't show the Cite tool if the config lacks any required keys

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

Deskana assigned this task to Jdforrester-WMF.
Deskana set the point value for this task to 1.

Not resolved. Still need to do the bit where we actually disable it.

Change 421328 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/Citoid@master] Follow-up 436464af: Actually don't show the Cite tool if the config is broken

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

Change 421328 merged by jenkins-bot:
[mediawiki/extensions/Citoid@master] Follow-up 436464af: Actually don't show the Cite tool if the config is broken

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