diff --git a/includes/skins/MinervaTemplate.php b/includes/skins/MinervaTemplate.php index 7e19af45c..7ce13a2b2 100644 --- a/includes/skins/MinervaTemplate.php +++ b/includes/skins/MinervaTemplate.php @@ -251,7 +251,7 @@ class MinervaTemplate extends BaseTemplate { 'id' => 'searchIcon', 'class' => MinervaUI::iconClass( 'magnifying-glass', 'element', 'skin-minerva-search-trigger' ), ], wfMessage( 'searchbutton' ) ), - 'secondaryButtonData' => $data['secondaryButtonData'], + 'userNotificationsData' => $data['userNotificationsData'], 'mainmenuhtml' => $this->getMainMenuHtml( $data ), 'hasheadingholder' => $hasHeadingHolder, 'taglinehtml' => $data['taglinehtml'], diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index e4976e8d2..d52e94e11 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -390,7 +390,7 @@ class SkinMinerva extends SkinTemplate { */ protected function prepareUserNotificationsButton( QuickTemplate $tpl, $newTalks ) { // Set user button to empty string by default - $tpl->set( 'secondaryButtonData', '' ); + $tpl->set( 'userNotificationsData', '' ); $notificationsTitle = ''; $count = 0; $countLabel = ''; @@ -441,7 +441,7 @@ class SkinMinerva extends SkinTemplate { $url = $notificationsTitle->getLocalURL( [ 'returnto' => $currentTitle->getPrefixedText() ] ); - $tpl->set( 'secondaryButtonData', [ + $tpl->set( 'userNotificationsData', [ 'notificationIconClass' => MinervaUI::iconClass( 'notifications' ), 'title' => $notificationsMsg, 'url' => $url, diff --git a/includes/skins/minerva.mustache b/includes/skins/minerva.mustache index 28ca08f82..791e75ac2 100644 --- a/includes/skins/minerva.mustache +++ b/includes/skins/minerva.mustache @@ -19,7 +19,7 @@ value="{{search}}">
{{{searchButton}}}
- {{^isAnon}}
{{#secondaryButtonData}}{{>secondaryButton}}{{/secondaryButtonData}}
{{/isAnon}} + {{^isAnon}}
{{#userNotificationsData}}{{>userNotifications}}{{/userNotificationsData}}
{{/isAnon}}
diff --git a/includes/skins/secondaryButton.mustache b/includes/skins/userNotifications.mustache similarity index 91% rename from includes/skins/secondaryButton.mustache rename to includes/skins/userNotifications.mustache index fda9035f4..df44d28aa 100644 --- a/includes/skins/secondaryButton.mustache +++ b/includes/skins/userNotifications.mustache @@ -1,12 +1,12 @@ {{^hasNotifications}} + class="{{notificationIconClass}} user-button main-header-button" id="user-notifications"> {{title}} {{/hasNotifications}} {{#hasNotifications}}
diff --git a/resources/skins.minerva.notifications/init.js b/resources/skins.minerva.notifications/init.js index bef7f4084..9d018ac55 100644 --- a/resources/skins.minerva.notifications/init.js +++ b/resources/skins.minerva.notifications/init.js @@ -41,7 +41,7 @@ return false; }, // eslint-disable-next-line no-jquery/no-global-selector - el: $( '#secondary-button.user-button' ).parent() + el: $( '#user-notifications.user-button' ).parent() } ); overlayManager.add( /^\/notifications$/, showNotificationOverlay ); diff --git a/skin.json b/skin.json index e25583bb0..62a576870 100644 --- a/skin.json +++ b/skin.json @@ -531,7 +531,7 @@ "resources/skins.minerva.notifications.badge/NotificationBadge.js" ], "templates": { - "badge.mustache": "includes/skins/secondaryButton.mustache" + "badge.mustache": "includes/skins/userNotifications.mustache" }, "targets": [ "mobile", diff --git a/tests/phpunit/skins/SkinMinervaTest.php b/tests/phpunit/skins/SkinMinervaTest.php index 6a67f94d9..58d5b23cf 100644 --- a/tests/phpunit/skins/SkinMinervaTest.php +++ b/tests/phpunit/skins/SkinMinervaTest.php @@ -173,7 +173,7 @@ class SkinMinervaTest extends MediaWikiTestCase { * * @covers ::prepareUserNotificationsButton * @dataProvider providePrepareUserNotificationsButton - * @param array|string $expectedSecondaryButtonData Expected test case outcome + * @param array|string $expectedUserNotificationsData Expected test case outcome * @param string $message Test message * @param Title $title * @param bool $useEcho Whether to use Extension:Echo @@ -187,7 +187,7 @@ class SkinMinervaTest extends MediaWikiTestCase { * @param string|bool $formattedEchoNotificationCount */ public function testPrepareUserNotificationsButton( - $expectedSecondaryButtonData, $message, $title, $useEcho, $isUserLoggedIn, + $expectedUserNotificationsData, $message, $title, $useEcho, $isUserLoggedIn, $newtalks, $lastUnreadAlertTime = false, $lastUnreadMessageTime = false, $echoNotificationCount = false, $alertSeenTime = false, $msgSeenTime = false, $formattedEchoNotificationCount = false @@ -241,8 +241,8 @@ class SkinMinervaTest extends MediaWikiTestCase { $skin->prepareUserNotificationsButton( $tpl, $newtalks ); $this->assertEquals( - $expectedSecondaryButtonData, - $tpl->get( 'secondaryButtonData' ), + $expectedUserNotificationsData, + $tpl->get( 'userNotificationsData' ), $message ); } @@ -257,7 +257,7 @@ class SkinMinervaTest extends MediaWikiTestCase { * @param bool $hasUnseen * @return array */ - private function getSecondaryButtonExpectedResult( + private function getUserNotificationsExpectedResult( $title, $notificationsMsg, $notificationsTitle, @@ -295,7 +295,7 @@ class SkinMinervaTest extends MediaWikiTestCase { Title::newFromText( 'Special:Notifications' ), true, true, 'newtalks alert' ], - [ $this->getSecondaryButtonExpectedResult( + [ $this->getUserNotificationsExpectedResult( $title, 'Show my notifications', 'Notifications', @@ -311,7 +311,7 @@ class SkinMinervaTest extends MediaWikiTestCase { MWTimestamp::getInstance( strtotime( '2017-05-12T07:18:42Z' ) ), 110, '2017-05-11T20:28:11Z', '2017-05-11T20:28:11Z', '99+' ], - [ $this->getSecondaryButtonExpectedResult( + [ $this->getUserNotificationsExpectedResult( $title, 'Show my notifications', 'Notifications', @@ -327,7 +327,7 @@ class SkinMinervaTest extends MediaWikiTestCase { MWTimestamp::getInstance( strtotime( '2017-03-27T17:07:57Z' ) ), 3, '2017-03-25T00:17:44Z', '2017-03-28T19:00:42Z', '3' ], - [ $this->getSecondaryButtonExpectedResult( + [ $this->getUserNotificationsExpectedResult( $title, 'Show my notifications', 'Notifications', @@ -343,7 +343,7 @@ class SkinMinervaTest extends MediaWikiTestCase { MWTimestamp::getInstance( strtotime( '2017-04-10T15:12:31Z' ) ), 3, '2017-04-12T10:37:13Z', '2017-04-11T12:55:47Z', '3' ], - [ $this->getSecondaryButtonExpectedResult( + [ $this->getUserNotificationsExpectedResult( $title, 'Show my notifications', 'Notifications', @@ -359,7 +359,7 @@ class SkinMinervaTest extends MediaWikiTestCase { MWTimestamp::getInstance( strtotime( '2017-12-15T08:14:33Z' ) ), 5, '2017-12-21T18:07:24Z', '2017-12-19T16:55:52Z', '5' ], - [ $this->getSecondaryButtonExpectedResult( + [ $this->getUserNotificationsExpectedResult( $title, 'Show my notifications', 'Notifications', @@ -387,7 +387,7 @@ class SkinMinervaTest extends MediaWikiTestCase { $title, false, false, '' ], [ '', 'No Echo, logged in, no talk page alerts', $title, false, true, '' ], - [ $this->getSecondaryButtonExpectedResult( + [ $this->getUserNotificationsExpectedResult( $title, 'You have new messages on your talk page', 'Mytalk',