Premising that UploadWizard already supports some nice URL parameters, including a ?categories=Foo|Bar to prefill these categories, and more:
https://commons.wikimedia.org/wiki/Commons:Upload_Wizard/Fields_prefilling
And premising that this prefilling is just great 🥰
The next natural step is about easily building correct URLs, possibly not manually, and possibly not using external tools, and possibly not creating more confusing user interfaces. So, the idea:
Feature summary: when interacting with categories, auto refresh the page URL to have consistent ?categories
When interacting with UploadWizard multimedia files:
- WHEN:
- every time a category picker is changed (for example, when you pick Category:One)
- or, every time a category is unpicked
- or, every time you click on Copy selection to other uploads
- WHAT:
- list all categories in use by all files, and mention these in the URL ?categories= 🎉
Use case FAQs:
- What if you upload just 1 file and you manually pick the category "One"?
- → you will get the URL ?categories=One - example: https://commons.wikimedia.org/wiki/Special:UploadWizard?categories=One
- What if you are uploading 20 files, where each file has different categories, and just 1 category is common among all files?
- → you will get the URL ?categories=One - example: https://commons.wikimedia.org/wiki/Special:UploadWizard?categories=One
- What if you are uploading 20 files, where only the categories "One" and "Two" are common categories for all these 20 files?
- → you will get the URL ?categories=One|Two - example - https://commons.wikimedia.org/wiki/Special:UploadWizard?categories=One|Two
- What if you are uploading 20 files, where each file has different categories?
- → no particular URL change. Basically it's the empty ?categories= - so - you get the clean URL https://commons.wikimedia.org/wiki/Special:UploadWizard
- What if you select a structured data common for 20 files?
- We should be prepared to easily implement this too, but structured data is out of this specific task. We can think about structured data in a parallel task.
Use case(s)
After you successfully upload some files:
- be able to copy the UploadWizard URL and bookmark it, to quickly re-use that context again for consequent uploads
- be able to share the UploadWizard URL to others, etc.
Benefits:
- non-technical users can easily upload images with same categories later (by just copy-pasting the URL)
- more people will be aware the existence of ?categories= and the concept of "fields prefilling" in general - as it would be somehow self-documented
- the URL will be arguably more consistent with the represented situation
- backward compatibility - the user interface remains unchanged
Implementation tips
The JavaScript "pushState" API is widely available in browser webs and allows to update the URL without reloading the page:
https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
(💡 Fun fact: the "pushState" technology is also used by Wikimedia Phabricator every single time we click on whatever internal link. When you click on links, we are really not visiting a different Phabricator URL, but the URL is refreshed and some Phabricator page content is refreshed. This thing was discovered during a fix for the "infinite rickroll" bug. You're welcome! lol - source: https://we.phorge.it/D26722 )
Tips for newcomers (example: Hackathon newcomers)
These sounds like the necessary things to be able to implement this feature:
- be happy about having a local MediaWiki in your computer, for tests
- some JavaScript knowledge
- some git knowledge (clone, commit)
The current git source code is here, in Wikimedia Gerrit:
https://gerrit.wikimedia.org/g/mediawiki/extensions/UploadWizard