- Login
- View a page with ResourceLoader debugging enabled: https://en.wikipedia.org/wiki/Main_Page?useskin=vector-2022&debug=1
Observe the last menu item has two icons:
Esanders | |
Sep 25 2022, 1:11 PM |
F35546689: Screen Shot 2022-10-04 at 10.44.31 AM.png | |
Oct 4 2022, 5:44 PM |
F35533142: image.png | |
Sep 25 2022, 1:11 PM |
Observe the last menu item has two icons:
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Fixes to addPortletLink hook handler | mediawiki/skins/Vector | master | +30 -9 |
ContentTranslation should be using mw.util.addPortletLink to add this menu item:
https://gerrit.wikimedia.org/g/mediawiki/extensions/ContentTranslation/+/e33dfcb14963a641bfc4c3f92b0dfe716d245517/modules/entrypoints/ext.cx.entrypoints.contributionsmenu.js#112
@Jdlrobson CX is using mw.util.addPortletLink - Infact you made that change a few months ago.
In debug mode alone, I see that addPortletLinkHandler in skins.vector.js/dropdownMenus.js is getting called two times.
I suspect the following code is problematic:
// Enhance previously added items. Array.prototype.forEach.call( document.querySelectorAll( '.mw-list-item-js' ), function ( item ) { addPortletLinkHandler( item, { id: item.getAttribute( 'id' ) } ); } ); mw.hook( 'util.addPortletLink' ).add( addPortletLinkHandler );
There is a chance that addPortletLinkHandler called more than once for same item and id depending on whether document.querySelectorAll( '.mw-list-item-js' ) returns the item which already fired the 'util.addPortletLink' hook event. addPortletLinkHandler adds two icons in that case.
@Jdlrobson CX is using mw.util.addPortletLink - Infact you made that change a few months ago.
Right. I stand corrected (The use of jQuery threw me).
The addPortletLinkHandler should only be called once on each item added.
Change 836254 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):
[mediawiki/skins/Vector@master] Fixes to addPortletLink hook handler
Change 836254 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Fixes to addPortletLink hook handler