Page MenuHomePhabricator

The module ext.uls.compactlinks and its associated beta feature should be disabled on new Vector
Closed, ResolvedPublic

Description

Universal Language Selector limits the list of languages to 10 and adds a button underneath that launches Universal Language Selector. This will cause problems for us as we move the language button position, so we will need a mechanism for disabling the loading of this module for modern Vector.

We will wire up a modified version of this code for Vector which simply renders the button.

Acceptance criteria

  • The code for the click handler for the language button is factored out into a lightweight module.
  • The UniversalLanguageSelector hook will need to check the Vector skin version and not load ext.uls.compactlinks if modern Vector is enabled.
  • When modern Vector is enabled a new module will be loaded that enhances the button being created in T260738 with the new factored out click handler
  • The new module should be tiny (<1kb)

QA steps

Enable "Use a compact language list, with languages relevant to you." on https://en.wikipedia.beta.wmflabs.org/wiki/Special:Preferences#mw-prefsection-rendering and visit https://en.wikipedia.beta.wmflabs.org/wiki/Limbourg_brothers. Check the button there works.

QA Results - Beta

ACStatusDetails
1T264824#6648675

QA Results - Prod

ACStatusDetails
1T264824#6672056

Event Timeline

Change 635081 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/UniversalLanguageSelector@master] Compact personal links can be wired up to an existing button

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

Jdlrobson added a subscriber: ovasileva.

Adding to sprint board for visibility that im working on this with langeng

Change 635677 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/UniversalLanguageSelector@master] WIP: Separate compacting of language list from launching of dialog

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

Change 635080 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@master] POC: Language button prototype

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

Change 635679 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/UniversalLanguageSelector@master] Allow skins to register their own button and disable compact

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

Change 635081 abandoned by Jdlrobson:
[mediawiki/extensions/UniversalLanguageSelector@master] Compact personal links can be wired up to an existing button

Reason:
The approach in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UniversalLanguageSelector/ /635677 and https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UniversalLanguageSelector/ /635679 is superior.

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

Change 635677 merged by jenkins-bot:
[mediawiki/extensions/UniversalLanguageSelector@master] Separate compacting of language list from launching of dialog

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

Change 641220 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/UniversalLanguageSelector@master] Compact language links module is loaded via server side

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

Change 635679 merged by jenkins-bot:
[mediawiki/extensions/UniversalLanguageSelector@master] Allow skins to register their own button and disable compact

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

Change 641220 merged by jenkins-bot:
[mediawiki/extensions/UniversalLanguageSelector@master] Compact language links module is loaded via server side

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

Edtadros added a subscriber: Edtadros.

Test Result - Beta

Status: ❌ FAIL
Environment: beta
OS: macOS Catalina
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Enable "Use a compact language list, with languages relevant to you." on https://en.wikipedia.beta.wmflabs.org/wiki/Special:Preferences#mw-prefsection-rendering and visit the main page.
❌ AC1: Check the button there works.
No button is visible.

I can reproduce this but have no idea why it's happening. @Nikerabbit do you have any ideas why this check might be failing on the beta cluster main page?
I can't reproduce locally, so I'm guessing the logic for noexternallanglinks might be to blame here but I don't want to assume. mw-interlanguage-selector does not appear in the page HTML and I'd assume that isCompactLinksEnabled always passes when the preference is set.

$excludedLinks = $out->getProperty( 'noexternallanglinks' );
$override = is_array( $excludedLinks ) && in_array( '*', $excludedLinks );
if ( !$override && self::isCompactLinksEnabled( $out->getUser() ) && strpos( $out->getHTML(), 'mw-interlanguage-selector' ) === false ) {

I'm sure the main page is excluded due to noexternallanglinks (similar to production enwiki main page). You can see {{noexternallanglinks}} near the bottom of the page source.

I suggest testing on some other page such as https://en.wikipedia.beta.wmflabs.org/wiki/Limbourg_brothers (picked from https://en.wikipedia.beta.wmflabs.org/wiki/Special:MostInterwikis).

Thanks @Nikerabbit for explaining!

@Edtadros I've updated the QA steps accordingly. Apparently, the main page is working as expected.

Test Result - Beta

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

Test Artifact(s):

QA Steps

Enable "Use a compact language list, with languages relevant to you." on https://en.wikipedia.beta.wmflabs.org/wiki/Special:Preferences#mw-prefsection-rendering
Visit https://en.wikipedia.beta.wmflabs.org/wiki/Limbourg_brothers.
✅ AC1: Check the button there works.

Test Result - PROD

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

Test Artifact(s):

QA Steps

Enable "Use a compact language list, with languages relevant to you." on https://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-rendering
Visit https://en.wikipedia.org/wiki/Limbourg_brothers.
✅ AC1: Check the button there works.