Page MenuHomePhabricator

Cleanup and simplify redundant code in MobileFrontend
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

Over the years various pieces of code have been accumulated that either never get run or do not apply to anything.

User story

As a developer I want a better understanding of the code I actually need to support.

Requirements

  • Remove unused config options per T409350.
  • Toggler using event bus emits a 'section-toggled' event that is never used. gerrit
  • The modules mobile.pagelist.styles and mobile.pagesummary.styles are only used on Special:EditWatchlist so should be merged into amobile.special.styles and scoped to .mw-special-EditWatchlist.mw-mf-amc-disabled so we have two less modules to maintain. (gerrit)
  • The includes/template/ContentBox.mustache template is no longer used gerrit
  • We provide unmaintained styles for MobileFrontend + Vector skins which is not publicly accessible in skinStyles/mobile.startup/vector.less gerrit
  • In src/mobile.init/mobile.init.js we have the following code block relating to a localStorage migration that happened 2 years ago (gerrit)
function migrateXLargeToLarge() {
	if ( document.documentElement.classList.contains( 'mf-font-size-clientpref-xlarge' ) ) {
		if ( mw.user.isAnon() ) {
			mw.user.clientPrefs.set( FONT_SIZE_KEY, 'large' );
		} else {
			api.saveOption( FONT_SIZE_KEY, 'large' );
		}
	}
}
function migrateLegacyExpandAllSectionsToggle() {
	const currentValue = mw.storage.get( 'expandSections' );
	if ( currentValue ) {
		if ( mw.user.isAnon() ) {
			mw.user.clientPrefs.set( SECTION_COLLAPSING_TOGGLE, '1' );
		} else {
			api.saveOption( SECTION_COLLAPSING_TOGGLE, '1' );
		}
		storage.remove( 'expandSections' );
	}
}

migrateXLargeToLarge();
migrateLegacyExpandAllSectionsToggle();
  • Following T385509 mobile.special.mobileoptions.scripts.js has a function infuseToggles which is only used once and only applies to one item. This should be simplified (possibly renaming infuseToggle. Original discussion/context. (gerrit)

BDD

  • For QA engineer to fill out

Test Steps

  • For QA engineer to fill out

Design

  • Add mockups and design requirements

Acceptance criteria

  • Add acceptance criteria

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

This task was created by Version 1.2.0 of the Web team task template using phabulous

Event Timeline

Change #1187084 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] Cleanup: Remove unused template and skinStyle

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

Jdlrobson-WMF renamed this task from Remove dead code in MobileFrontend to Cleanup and simplify redundant code in MobileFrontend.Oct 28 2025, 3:57 PM
Jdlrobson-WMF updated the task description. (Show Details)

I'm going to break out some of the items above into smaller tasks that we will estimate/work on individually.

Change #1187084 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Cleanup: Remove unused template and skinStyle

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

HSwan-WMF updated the task description. (Show Details)
HSwan-WMF set the point value for this task to 3.Nov 19 2025, 6:05 PM

Change #1214082 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] Remove migration code for font size and expand sections

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

Change #1214088 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] Remove pagelist.styles and pagesummary.styles modules

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

Change #1214096 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] Cleanup: rename function from plural to singular

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

Change #1214082 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Cleanup: Remove migration code for font size and expand sections

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

Change #1214096 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Cleanup: simplify infuseToggle function

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

Change #1214088 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Cleanup: Remove pagelist.styles and pagesummary.styles modules

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

Hey @lwatson @egardner looks like this caused a quite noticeable regression: T411918: Regression: Languages header appearing much larger. there are no deploys next week but let's get this fixed and make sure it doesn't ride the train!

KSarabia-WMF subscribed.

Looks good to me! The requirements have been met. See no visible regressions on MobileFrontend and there is already a follow up ticket for the one.