Page MenuHomePhabricator

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

Description

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?)

QA steps

  • Visit Special:EditWatchlist as a logged in user on mobile with AMC disabled. The date should be parsed correctly and not look like this:

Screen Shot 2021-04-28 at 9.26.21 AM.png (240×1 px, 39 KB)

but like this:
Screen Shot 2021-04-28 at 9.26.47 AM.png (224×750 px, 35 KB)

[1] https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/src/mobile.startup/time.js

QA Results - Beta

ACStatusDetails
1T259628#7053832

QA Results - Prod

ACStatusDetails
1T259628#7071121

Event Timeline

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

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

{{fullurl:{{FULLPAGENAME}}|action=history}}

@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}}')
mw.message('foo').parse()

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();

Change 682943 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/MobileFrontend@master] mobile.startup: Remove wasteful time.getLastModifiedMessage() usage

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

Change 682944 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/MobileFrontend@master] mobile.startup: Use jQuery instances in time.getLastModifiedMessage()

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

Change 682944 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] mobile.startup: Use jQuery instances in time.getLastModifiedMessage()

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

Change 682943 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] mobile.startup: Remove unnecessary time.getLastModifiedMessage() usage

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

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

✅ AC1: Visit Special:EditWatchlist as a logged in user on mobile with AMC disabled. The date should be parsed correctly.

Screen Shot 2021-05-03 at 9.18.34 AM.png (729×822 px, 88 KB)

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: iPhone 11 Pro Max

Test Artifact(s):

QA Steps

✅ AC1: Visit Special:EditWatchlist as a logged in user on mobile with AMC disabled. The date should be parsed correctly.

en.m.wikipedia.org_wiki_Special_EditWatchlist(iPhone 11 Pro Max).png (2×1 px, 318 KB)