Page MenuHomePhabricator

Category is duplicated when used on a page and interface message in the same OutputPage
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

/* _addText: [[Category:Noop]] */

What happens?:
The Noop category appears twice in the category column.

image.png (423×1 px, 45 KB)

Other information (browser name/version, screenshots, etc.):
The Chinese Wikipedia has made some changes to MediaWiki:Clearyourcache so that JSON, JavaScript and CSS pages can display wikitext (we call this project Special wikitext). Even so, the category column should still not display categories twice.

Details

Event Timeline

Bhsd subscribed.

I do not see how CodeMirror is involved.

Shizhao closed this task as Declined.EditedFeb 8 2025, 8:58 AM
Shizhao subscribed.

I'm sorry, But from a technical perspective, no matter how we edit the Special Wikitext.js/.lua/.wikitext script, it will not help. No matter how we modify it, it is absolutely impossible to make these two duplicated Categorys become just only one. So I strongly oppose your proposal. It is strongly requested that this task be reopened.

Because the Special Wikitext.js/.lua/.wikitext script DOES NOT have the ability to control the Category Bar!

SunAfterRain moved this task from Closed to MediaWiki core on the Chinese-Sites board.

After discussion, we think @Shizhao misunderstood, so I reopened this task.

This problem occurs when the interface message used in the page has a category and the page also has a same category, see test case:
https://patchdemo.wmcloud.org/wikis/5293491307/wiki/Talk:Main_Page

Dylsss renamed this task from The same category name appears repeatedly in the category column to Category is duplicated when used on a page and interface message in the same OutputPage.Feb 9 2025, 12:59 PM

While duplicate categories to the same OutputPage should probably be de-duplicated in general. It also isn't correct that adding an interface message to an OutputPage adds its own categories to the category links of the OutputPage. See for example https://patchdemo.wmcloud.org/wikis/5293491307/wiki/MediaWiki_talk:Talkpageheader which has Category:Noop from the interface message, but this is actually a red herring as the page is not actually in that category.

Change #1118251 had a related patch set uploaded (by Dylsss; author: Dylsss):

[mediawiki/core@master] Suppress category metadata for extraneous ParserOutputs

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

在T385860#10534398中,@PatchDemoBot写道:

Test wiki created on Patch demo by Shizhao using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/549efe3ce3/w/

see https://patchdemo.wmcloud.org/wikis/549efe3ce3/wiki/Talk:Main_Page and https://patchdemo.wmcloud.org/wikis/549efe3ce3/wiki/MediaWiki_talk:Talkpageheader

The patch fixes the duplicate categories issue, but the categories in the interface message do not appear in the page where the message is embedded. Is this the intended solution? @SunAfterRain @A2569875

While duplicate categories to the same OutputPage should probably be de-duplicated in general. It also isn't correct that adding an interface message to an OutputPage adds its own categories to the category links of the OutputPage. See for example https://patchdemo.wmcloud.org/wikis/5293491307/wiki/MediaWiki_talk:Talkpageheader which has Category:Noop from the interface message, but this is actually a red herring as the page is not actually in that category.

I think directly suppressing categories may not be an appropriate solution, as we cannot rule out the possibility that some people deliberately rely on adding categories to these pages to achieve their desired effects.

You cannot add categories this way, it may look like you can, but when you actually click on the category the page is not there. This is why I described it as a red herring.

The patch just aligns the UI with what is actually stored in the database, it doesn't affect what pages actually are added to a category.

Test wiki on Patch demo by Shizhao using patch(es) linked to this task was deleted:

https://patchdemo.wmcloud.org/wikis/549efe3ce3/w/