Page MenuHomePhabricator

Index Page is sorted differently in category, depending on how Category is added
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

What should have happened instead?:
Should be sorted under letter P in both cases

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

Event Timeline

Looking at the API-response you can see that the categories added to the Category section of the index page have sort_keys set to the category name. Since these are explicitly set they can't even be overridden using DEFAULTSORT.

The sort keys are however not serialized in the APIs wikitext output.

My guess is that the handling of the pipe-separated input format (mentioned in the help blurb but which no longer seems to be supported) is somehow behind the accidental sort key

Dug into this again. The culprit is L580 of includes/Index/IndexContentHandler.php which accidentally sets the sort key to the category title. In my local environment I could fix this easily.

It doesn't explain why the same doesn't happen to categories added as wikitext in e.g. the Pages-field. These are extracted in L205 of in includes/Index/IndexContentHandler.php but my fix didn't affect that behaviour so not going to dig into it further.

Change #1152372 had a related patch set uploaded (by Lokal Profil; author: Lokal Profil):

[mediawiki/extensions/ProofreadPage@master] Remove incorrect sortKey addition

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

@Tpt will you have an opportunity to take a look at the patch? All I did was to drop a parameter in the parserOutput->addCategory call.

@Tpt will you have an opportunity to take a look at the patch? All I did was to drop a parameter in the parserOutput->addCategory call.

Thanks @Tpt. Since the gate-and-submit job stalled I took the opportunity to update the patch per your recommendation.

Change #1152372 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] Remove incorrect sortKey addition

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

Lokal_Profil claimed this task.
Lokal_Profil moved this task from 📥 Backlog to ☑️ Done on the User-Lokal_Profil board.

Did a blank edit to the page and can confirm that both are now sorted under P