Page MenuHomePhabricator

Special:GlobalContributions ignores namespace in links
Closed, ResolvedPublicBUG REPORT

Description

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

What happens?:

You are taken to https://test.wikipedia.org/wiki/Count_Count

What should have happened instead?:

The link should arrive to https://test.wikipedia.org/wiki/User_talk:Count_Count (ie. link should include the namespace)

Other information (browser name/version, screenshots, etc.):

Note the set of namespaces can be wiki-specific. While all wikis would have an User talk namespace (reachable using that english name if needed), this doesn't have to be the case for all other namespaces.

Also note the namespace IDs can have different meanings on different wikis. For example, at commons.wikimedia.org, NS ID 100 means Creator, at test.wikipedia.org, it is Test namespace 1 and at metawiki, it doesn't exist.

Event Timeline

Searching at https://meta.wikimedia.org/wiki/Special:GlobalContributions/2A00:102A:5021:7EE5:ECAD:4C81:60DD:BC68 shows this:

01:13, 25 October 2024 diff hist  +8  test.wikipedia.org  N Special:Badtitle/NS100:Urbanecm testing  ~2024-7669 (talk) current

Note the Special:Badtitle part. This is because NS100 exists at test.wikipedia.org, but not at meta. Since it is very closely related to the first namespace-related problem, I'm not filling a special task for this.

Change #1083152 had a related patch set uploaded (by STran; author: STran):

[mediawiki/extensions/CheckUser@master] [WIP] Respect namespace in Special:GC article link parameter

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

I made ^ as a proof of concept but as Martin mentions, this can vary between wikis. I think to be accurate, we'd want to take the namespace id provided by the row and compare it to that wiki's namespaces. If we can justify more API calls, the query we probably want to run and check against is api.php?action=query&format=json&prop=&meta=siteinfo&formatversion=2&siprop=namespaces.

cc @Tchanders I know you've been working on making external wiki calls.

If we're worried about page load times, maybe we could do this call and link out as a progressive enhancement with javascript instead? Although I think linking to the right link is kind of important...

Change #1083383 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Fix namespaces for external links

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

Change #1083383 abandoned by STran:

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Fix namespaces for external links

Reason:

Abandoned in favor of I8ba05eb3994a1050bd9010b774be962845256be2

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

Change #1083383 restored by STran:

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Fix namespaces for external links

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

Change #1083152 abandoned by STran:

[mediawiki/extensions/CheckUser@master] [WIP] Respect namespace in Special:GC article link parameter

Reason:

Abandoned in favor of Ib0fdb538e3d4de67a359e703fc7760da3b69cab3

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

Change #1083849 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Use Special:PermanentLink to construct link

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

Change #1083853 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.28] GlobalContributionsPager: Use Special:PermanentLink to construct link

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

Change #1083849 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Use Special:PermanentLink to construct link

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

Change #1083883 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Don't display external namespace in article link

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

Change #1083886 had a related patch set uploaded (by Kosta Harlan; author: Tchanders):

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.28] GlobalContributionsPager: Don't display external namespace in article link

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

Change #1083886 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.28] GlobalContributionsPager: Don't display external namespace in article link

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

Change #1083853 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.28] GlobalContributionsPager: Use Special:PermanentLink to construct link

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

Mentioned in SAL (#wikimedia-operations) [2024-10-28T20:30:55Z] <kharlan@deploy2002> Started scap sync-world: Backport for [[gerrit:1083874|Partial Revert "Make sure contributor's name is on its line" (T378142)]], [[gerrit:1083877|Restore missing second argument to "mapState" in QuickView.vue (T378204)]], [[gerrit:1083853|GlobalContributionsPager: Use Special:PermanentLink to construct link (T378155)]], [[gerrit:1083886|GlobalContributionsPager: Don't display external namespace in

Mentioned in SAL (#wikimedia-operations) [2024-10-28T20:33:06Z] <kharlan@deploy2002> jdlrobson, kharlan: Backport for [[gerrit:1083874|Partial Revert "Make sure contributor's name is on its line" (T378142)]], [[gerrit:1083877|Restore missing second argument to "mapState" in QuickView.vue (T378204)]], [[gerrit:1083853|GlobalContributionsPager: Use Special:PermanentLink to construct link (T378155)]], [[gerrit:1083886|GlobalContributionsPager: Don't display external namespace in artic

Mentioned in SAL (#wikimedia-operations) [2024-10-28T20:42:19Z] <kharlan@deploy2002> Finished scap sync-world: Backport for [[gerrit:1083874|Partial Revert "Make sure contributor's name is on its line" (T378142)]], [[gerrit:1083877|Restore missing second argument to "mapState" in QuickView.vue (T378204)]], [[gerrit:1083853|GlobalContributionsPager: Use Special:PermanentLink to construct link (T378155)]], [[gerrit:1083886|GlobalContributionsPager: Don't display external namespace in

Change #1083901 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Make article link redirect to the page

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

We've fixed this by using Special:Permalink on the foreign wiki along with the revision ID. That means that we just display the title, rather than the title with the namespace prefix. We'll work on improving that.

Note the set of namespaces can be wiki-specific. While all wikis would have an User talk namespace (reachable using that english name if needed), this doesn't have to be the case for all other namespaces.

As noted in T226667#5298514, it seems like we could rely on the core namespaces (-2 to 15), even if their meaning is different across projects. If that's the case, we would use getPrefixedText() to show the namespace + title if the namespace is in the range of -2 to 15, and then use getText() (without the prefix) for other namespaces.

Change #1083902 had a related patch set uploaded (by Kosta Harlan; author: Tchanders):

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.28] GlobalContributionsPager: Make article link redirect to the page

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

Change #1083902 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.28] GlobalContributionsPager: Make article link redirect to the page

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

Mentioned in SAL (#wikimedia-operations) [2024-10-28T21:17:30Z] <kharlan@deploy2002> Started scap sync-world: Backport for [[gerrit:1083902|GlobalContributionsPager: Make article link redirect to the page (T378155)]]

Mentioned in SAL (#wikimedia-operations) [2024-10-28T21:19:40Z] <kharlan@deploy2002> kharlan: Backport for [[gerrit:1083902|GlobalContributionsPager: Make article link redirect to the page (T378155)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-10-28T21:26:31Z] <kharlan@deploy2002> Finished scap sync-world: Backport for [[gerrit:1083902|GlobalContributionsPager: Make article link redirect to the page (T378155)]] (duration: 09m 01s)

Change #1083883 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Don't display external namespace in article link

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

Change #1083901 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] GlobalContributionsPager: Make article link redirect to the page

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

Re-assigning to myself for follow-up work on showing the common namespaces (T378155#10270367) and getting other namespaces via the API (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CheckUser/+/1083383).

Change #1088568 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] Show namespaces for external articles in Special:GloalContributions

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

Change #1088573 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/core@master] ContributionsPager: Make $namespaceInfo property protected

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

Change #1088573 merged by jenkins-bot:

[mediawiki/core@master] ContributionsPager: Make $namespaceInfo property protected

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

Change #1088568 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Show namespaces for external articles in Special:GlobalContributions

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

All the links seem to work now except for the history link, which still leads to the wrong namespace – from the example above, clicking the "hist" link opens https://test.wikipedia.org/wiki/Count_Count?action=history instead of https://test.wikipedia.org/wiki/User_talk:Count_Count?action=history

Change #1092882 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] Link to the correct page from external history links

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

@Johannnes89 Thanks for the report - I've pushed a fix.

Change #1092882 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Link to the correct page from external history links

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

Re-assigning to myself for [...] getting other namespaces via the API (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CheckUser/+/1083383).

Spun out into a separate task, so we can move this onto testing and prioritize other work - and also to highlight that the API idea is a bit hacky: T380903: Display wiki-specific namespaces in external article links on Special:GlobalContributions

dom_walden subscribed.

I see that we are displaying and linking to local namespaces correctly, even custom ones.

For external wikis, we also show namespaces for common namespaces (e.g. File, Talk, etc.) but not namespaces which are custom to the external wiki. The Special:Redirect links are still correct.

Custom namespace that are local to the wiki you are accessing Special:GlobalContributions:

namespaces.png (1,214×208 px, 77 KB)

Custom namespaces from an external wiki:

namespaces_other.png (955×206 px, 58 KB)

Test environment: local docker MediaWiki 1.44.0-alpha (ea073fd) 07:04, 29 November 2024.