Page MenuHomePhabricator

Last modified bar in Minerva is parsing invalid wikitext - could break in future
Open, MediumPublic3 Estimated Story Points


Using relative URIS in wikitext is technically invalid wikitext but the last modified bar code [1] relies on this with wikitext in the form:

e.g. [/wiki/Foo test] by [/wiki/User user]

This caused a recent regression T259565.

While I am sympathetic to our use case here - we should be able to do this using interwiki links

e.g. [[Special:History/Title|title]] edited by [[User:Jon|Jon]]
Note: the history page may have to be an absolute uri for wikis where Special:History does not exist (I don't think there's an easy way to link to action URIs?)


Event Timeline

Jdlrobson triaged this task as High priority.
Jdlrobson moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.

I don't think there's an easy way to link to action URIs?


@Izno I don't think that works on the client side?

@Izno I don't think that works on the client side?

On the client side? Not sure what "client" means in context. That is valid wikitext and will generate a protocol relative URL to the current page's history page.

You can probably look up the equivalent PHP trivially.

Client side as in JavaScript

I've tried this out and it doesn't seem to work in JS as there's no magic word support there for fullurl or FULLPAGENAME:

mw.messages.set('foo', '{{fullurl:{{FULLPAGENAME}}|action=history}}')

Ah yeah, ok. And I went and looked at the other task.

Seems kind of weird that MobileFrontend wasn't using the MediaWiki message system in the first place. That seems like the proper fix here to me... :)

The message has to be done in javascript as it uses relative timestamps e.g. 3 hour ago so is not cacheable. For history i think we will thus have to make do with an absolute uri.

Should we change it to use full url? mw.Title does not provide equivalent of Title::getFullUrl() method but it'd be trivial to implement in MobileFrontend or add support for, in the core method if need be.

We could pass the history link as a full uri yes. It would however been that users on mobile domain would be pointed to the desktop domain (and unnecessary redirect) due to T156847.

Jdlrobson added a subscriber: ovasileva.
ovasileva lowered the priority of this task from High to Medium.Sep 23 2020, 4:44 PM
ovasileva set the point value for this task to 3.

You can pass a jQuery object containing an <a> element for the link target.

mw.messages.set( 'foo', 'hello [$1 world]' );
mw.message( 'foo', $( '<a>' ).attr( 'href', '/wiki/...' ) ).parseDom();