https://bugzilla.wikimedia.org/show_bug.cgi?id=35082
Web browser: ---
Bug #: 35082
Summary: mediaWiki.util.addPortletLink incorrectly adds link to
all uw tags in portlet
Product: MediaWiki
Version: 1.19
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Javascript
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Mobile Platform: ---
mediaWiki.util.addPortletLink incorrectly adds the created portlet link to all
uw tags in a portlet.
For most skins, addPortletLink uses the following logic to decide where to add
the newly created link:
// Select the first (most likely only) unordered list inside the portlet
$ul = $portlet.find( 'ul' );
.find('ul') does of course find /all/ unordered list tags in the portlet
element.
This can be problematic for utilities that place further unordered lists in the
portlet to create submenus.
While doing that might not be directly supported by MediaWiki, I don't see
there's ever a cause to add a portlet link multiple times.
Assuming that the jQuery filter function ".first()" is deterministic and works
as I think it does, I assume that changing the aforementioned line to
$ul = $portlet.find( 'ul' ).first();
would fix the issue without breaking functionality that anybody relies on (or
should rely on). Judging by the comment that was the intended behavior in the
first place.
Steps to reproduce:
wgUserGroups.push("sysop"); //to convince easyblock to show up
importScriptURI('//en.wikipedia.org/w/index.php?action=raw&ctype='+
'text/javascript&title=User:Animum/easyblock.js');
//wait till import finished before executing the next line
mw.util.addPortletLink( "p-cactions", "#", "TEST" );
-> the 'TEST' item is both in the "p-cactions" menu and in each of easyblock's
submenus.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l