diff --git a/includes/Components/VectorComponentUserLinks.php b/includes/Components/VectorComponentUserLinks.php index fffa23a51..0c866e5ef 100644 --- a/includes/Components/VectorComponentUserLinks.php +++ b/includes/Components/VectorComponentUserLinks.php @@ -124,8 +124,8 @@ class VectorComponentUserLinks implements VectorComponent { return $additionalData + [ 'is-temp-user' => $user->isTemp(), 'is-wide' => count( $overflowMenu ) > 3, - 'data-user-menu-overflow' => $overflowMenu->getTemplateData(), - 'data-user-menu-dropdown' => $userMenuDropdown->getTemplateData(), + 'data-user-links-overflow-menu' => $overflowMenu->getTemplateData(), + 'data-user-links-dropdown' => $userMenuDropdown->getTemplateData(), 'data-dropdown-menu' => $userMenu->getTemplateData(), 'data-account-links' => $this->accountMenu->getTemplateData(), ]; diff --git a/includes/templates/UserLinks.mustache b/includes/templates/UserLinks.mustache index af8f936ad..020f86cd7 100644 --- a/includes/templates/UserLinks.mustache +++ b/includes/templates/UserLinks.mustache @@ -1,20 +1,4 @@ diff --git a/includes/templates/UserLinksDropdown.mustache b/includes/templates/UserLinksDropdown.mustache new file mode 100644 index 000000000..874c4c35a --- /dev/null +++ b/includes/templates/UserLinksDropdown.mustache @@ -0,0 +1,15 @@ +{{#data-user-links-dropdown}}{{>Dropdown/Open}}{{/data-user-links-dropdown}} + {{#is-anon}} + {{#is-temp-user}} + {{>UserLinks__templogin}} + {{/is-temp-user}} + {{^is-temp-user}} + {{>UserLinks__login}} + {{/is-temp-user}} + {{/is-anon}} + {{#data-dropdown-menu}}{{>MenuContents}}{{/data-dropdown-menu}} + {{^is-anon}} + {{!-- The #pt-logout ID is required for the AJAX enabled logout in mediawiki.page.ready to work.}} + {{#data-account-links}}{{>MenuContents}}{{/data-account-links}} + {{/is-anon}} +{{#data-user-links-dropdown}}{{>Dropdown/Close}}{{/data-user-links-dropdown}} diff --git a/tests/jest/userLinksData.js b/tests/jest/userLinksData.js index f14dfe340..4a16b26ec 100644 --- a/tests/jest/userLinksData.js +++ b/tests/jest/userLinksData.js @@ -2,6 +2,7 @@ const mustache = require( 'mustache' ); const fs = require( 'fs' ); const menuContents = fs.readFileSync( 'includes/templates/MenuContents.mustache', 'utf8' ); const userLinksTemplate = fs.readFileSync( 'includes/templates/UserLinks.mustache', 'utf8' ); +const userLinksDropdownTemplate = fs.readFileSync( 'includes/templates/UserLinksDropdown.mustache', 'utf8' ); const dropdownOpenTemplate = fs.readFileSync( 'includes/templates/Dropdown/Open.mustache', 'utf8' ); const dropdownCloseTemplate = fs.readFileSync( 'includes/templates/Dropdown/Close.mustache', 'utf8' ); const pinnedContainerOpenTemplate = fs.readFileSync( 'includes/templates/PinnableContainer/Pinned/Open.mustache', 'utf8' ); @@ -16,7 +17,7 @@ const MenuListItem = fs.readFileSync( 'includes/templates/MenuListItem.mustache' const templateData = { 'is-wide': false, - 'data-user-menu-overflow': { + 'data-user-links-overflow-menu': { id: 'p-personal-more', class: 'mw-portlet mw-portlet-vector-user-menu-overflow vector-user-menu-overflow', label: 'Toggle sidebar', @@ -28,7 +29,7 @@ const templateData = {