Page MenuHomePhabricator

Add a way to detect "latest revision" vs "older revision" vs "preview"
Open, Needs TriagePublic

Description

Steps to reproduce: look at https://en.wiktionary.org/w/index.php?title=kvaza%C5%AD&oldid=28810413

Expected outcome: no stupid complaints, no useless tracking cats

Currently "preview" can be detected by means of hacky

((f:preprocess ('{{REVISIONID}}') == '')

but there is no way to detect "older revision" ie viewing a revision other than the current one by explicitly picking it from the page history.

Who would benefit: end users and module developers.

Being able to distinguish "latest revision" vs "older revision" would allow modules to avoid complaints and tracking cats in the latter case, when such are blatantly pointless. Complaints and tracking cats should get fired only for "preview" and for "latest revision".

Proposed solution: add a function, comparable to

mw.isSubsting()

returning a tristate value depending on "latest revision" vs "older revision" vs "preview".

Event Timeline

Functions would be a Scribunto matter. That said it can be good as a PF too.

The preview vs non-preview case can be implemented cheaply, as in https://phabricator.wikimedia.org/rELUA686c6a5fd47b60b77166ae519b06237abd6c4dbe (For this I should CC @ori and @thiemowmde while noting that w:Module:Citation/CS1 is absolutely popular). CS1 is currently counting as 1 expensive call, possibly for this expansion (not sure).

The non-preview old vs new case is trickier. Comparing {{REVISIONID}} against {{REVISIONID:{{FULLPAGENAME}}}} (on a talk page to circumvent miser restrictions) does not actually work, maybe something to do with the second parse. Perhaps a more enlightened parser person could find a way to do it, maybe even inexpensively.