Page MenuHomePhabricator

Automatically redirect users to the correct category in the UploadWizard (Wikimedia Commons)
Open, Needs TriagePublic

Description

When you wish to upload something to Wikimedia Commons but aren't 100% familiar with the the appropriate name of the category you often get a list of categories based on what you search 🔍. However if you would add a category that's only a redirect the files you upload will end up in the redirect and will have to be moved either manually or automatically by a bot, let's say the category is called "Bridges in Brazil" but you add it to "Brazilian bridges" then the files end up in the latter category, one way for redirects to work better (and to actually be a benefit to the users rather than a sometimes confusing hassle) would be that even if you click on "Brazilian bridges" that the UploadWizard will then automatically "autocorrect" it as "Bridges in Brazil".

Event Timeline

Adding project tags. To identify the right project(s), use the search function to find its description. Thanks.

Vvjjkkii renamed this task from Automatically redirect users to the correct category in the UploadWizard (Wikimedia Commons) to fmbaaaaaaa.Jul 1 2018, 1:05 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from fmbaaaaaaa to Automatically redirect users to the correct category in the UploadWizard (Wikimedia Commons).Jul 1 2018, 9:21 PM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.
kaldari subscribed.

Note that this bug causes a lot of extra work for the Commons community and should be fairly easy to fix.

@kaldari: A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor. Given the current description with no pointers how to detect redirected categories I'm removing the good first task tag. Please feel free to add sufficient details for a new contributor, and then add back the good first task project tag. Thanks a lot in advance!

  1. download https://commons.wikimedia.org/wiki/Category:Blue_cars?action=raw
  2. /{{\([Ss]eecat\|[Cc]ategoryredirect\|[Ss]ee cat\|[Cc]atredirect\|[Cc]at[ -]red\|[Cc]atredir\|[Rr]edirect category\|[Rr]edirect cat\|[Cc]ategory Redirect\)/ or whatever and fish for the first parameter
  3. profit

I was initially thinking we could just set redirects=resolve in the opensearch API call, but @AlexisJazz's post reminds me that Commons category redirects aren't actually redirects. <Bangs head on wall>

So yeah, we could download the contents of every added category, use a regex to search for the specific template that Commons uses, and then substitute the first parameter, although this has the following problems:

  1. It's very fragile and likely to break if Commons changes the template.
  2. It won't work on the 589 other wikis that have UploadWizard installed.
  3. It will slow down the upload process.
  4. It's extremely bad practice to hard-code anything based on wiki content into a MediaWiki extension (See problems #1 and #2).

We could also use the JavaScript code that HotCat uses, which is slightly less fragile and slightly faster than AlexisJazz's suggestion. (It uses specific API queries for links and category membership rather than regexes.) But it's still a Commons-specific hack.

Frankly, I think the decision to not use real redirects was a mistake on the part of the Commons community. The entire reason they chose to use a template instead of real redirects is because they thought people would be less likely to misplace files if there was a big notice at the top of the category page. History has shown that this didn't make any difference and now we're stuck with a system than isn't software-friendly. I don't suppose Commons would consider switching back to real redirects?