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

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

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

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