Page MenuHomePhabricator

Make Hovercards work with Special:MyLanguage links
Open, LowPublic

Description

Links that use Special:MyLanguage/ prefix don't currently work with Hovercards.
Is it possible to make these work?
(I see that navpopups also does not work with these links, so perhaps unfeasible)

Example URL: The first 2 links within https://www.mediawiki.org/wiki/Extension:Popups (Special:MyLanguage/Beta_Features and Special:MyLanguage/Beta_Features/Hovercards)

(Discussed onwiki at https://www.mediawiki.org/wiki/Topic:Tbb6kuwn6l95dppd )

Event Timeline

ovasileva added a subscriber: ovasileva.

might merge with other changes to hovercards on mediawiki

Jdlrobson added a subscriber: Jdlrobson.

Not sure what the generic solution would be for this. Needs some thought from devs.

For comparison, what do you do with links that go to redirect pages?

@Nikerabbit those are handled by the API as all we do is request the page from the API and tell it to follow redirects. If Special:MyLanguage can behave the same then this would just work... but I'm guessing it doesn't?

The API follows redirects by using the redirect table in the database. It also tends to treat Special-page links as, well, special and doesn't do very much with them at all.

It would be possible to have ApiPageSet follow RedirectSpecialArticle redirects too, I suppose. Other RedirectSpecialPage subclasses wouldn't make much sense, though, since they're probably trying to add other URL parameters that API redirect-following isn't going to be able to handle.

Change 341374 had a related patch set uploaded (by anomie):
[mediawiki/core] ApiPageSet: Follow RedirectSpecialArticle redirects

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

@Tgr I'm not too familiar with this code.. would you be able to help with review?

Assuming the API part is done, we still need to modify the PagePreviews codebase to enable 'Special:MyLanguage/' links.

Change 341374 merged by jenkins-bot:
[mediawiki/core@master] ApiPageSet: Follow RedirectSpecialArticle redirects

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

I guess we don't attempt to load a page preview when a link is prefixed "Special:". We'd have to either maintain a whitelist or pages to attempt to load page previews for all "Special:" prefixed links just in case.

I guess we don't attempt to load a page preview when a link is prefixed "Special:". We'd have to either maintain a whitelist or pages to attempt to load page previews for all "Special:" prefixed links just in case.

It's a little more complicated than a whitelist (see processLinks.js) but yes, in principle, this is how we'd handle titles in NS_SPECIAL.

The real question is whether RESTBase can handle titles like Special:MyLanguage/Beta_Features/Hovercards /cc @GWicke.

Note that special page names can be localized, so that e.g. on the Persian Wikipedia the link might look like ویژه:زبان‌های_من/Beta_Features/Hovercards.