Page MenuHomePhabricator

MobileFormatter: Do not scrub elements on pages in template namespace
Closed, ResolvedPublic

Description

Scrubbing elements on template pages MobileFormatter::filterContent can cause confusion to editors.
For example https://hu.m.wikipedia.org/wiki/Sablon:%C3%9Ajpest_FC_keret which features a navbox and no other HTML shows as an empty page!

Acceptance criteria

  • Do not apply the MobileFormatter transformation to content in the template namespace. To do this we will update the logic in the hook that transforms the content.
  • The new logic should be configurable so we can exclude other namespaces in future. We'll add a config variable called wgMFMobileFormatterNamespaceBlacklist which should default to [ NS_TEMPLATE, NS_SPECIAL ]. This will allow us to add other namespaces easily if necessary.

Developer notes

For extra points and kudos the isSpecialPage checks inside https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/includes/MobileFormatter.php#L180 should be no longer necessary as a result of this change. Please remove this code in a follow up to your change. Good work!

Google Code in

@Jdlrobson will help mentor this.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 21 2017, 7:23 PM
Jdlrobson moved this task from Backlog to Tasks on the MobileFrontend board.Jul 13 2017, 5:59 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)Nov 15 2017, 7:40 PM

Change 394650 had a related patch set uploaded (by Pppery; owner: Pppery):
[mediawiki/extensions/MobileFrontend@master] Don't run MobileFormatter in Template namespace

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

Pppery claimed this task.Dec 2 2017, 4:23 PM

I don't think adding yet another configuration variable is reasonable here. We already have way too many configuration variables and we should be focused instead on having sane default behavior.

It would be better to just remove filterContent altogether and stop mangling pages. This would prevent the need to disable the functionality per-namespace.

Change 394650 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Don't run MobileFormatter in Template namespace

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

Change 395065 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Docs: Update documentation for MFMobileFormatterNamespaceBlacklist

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

Jdlrobson closed this task as Resolved.Dec 4 2017, 6:51 PM

I've verified the fix. The .nomobile class now shows on template namespace and section collapsing is no longer applying meaning none of the mobile transforms are running on that page:
https://en.m.wikipedia.beta.wmflabs.org/wiki/Template:Nomobile

Thanks @Pppery !

Change 395065 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Docs: Update documentation for MFMobileFormatterNamespaceBlacklist

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