Hygiene: rename "secondary button" to "user notifications"

The secondary button is not generic. Rename it to match its specific
purpose.

Bug: T214540
Change-Id: I50b7e7fa7bea91a029a8ca71199b0309dff1c518
This commit is contained in:
Stephen Niedzielski 2019-06-19 11:31:16 -06:00
parent 02726555e0
commit 1e61706e0e
7 changed files with 19 additions and 19 deletions

View file

@ -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'],

View file

@ -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,

View file

@ -19,7 +19,7 @@
value="{{search}}">
</div>
<div>{{{searchButton}}}</div>
{{^isAnon}}<div>{{#secondaryButtonData}}{{>secondaryButton}}{{/secondaryButtonData}}</div>{{/isAnon}}
{{^isAnon}}<div>{{#userNotificationsData}}{{>userNotifications}}{{/userNotificationsData}}</div>{{/isAnon}}
</form>
</header>
<main id="content" class="mw-body">

View file

@ -1,12 +1,12 @@
{{^hasNotifications}}
<a href="{{url}}" title="{{title}}"
class="{{notificationIconClass}} user-button main-header-button" id="secondary-button">
class="{{notificationIconClass}} user-button main-header-button" id="user-notifications">
{{title}}
</a>
{{/hasNotifications}}
{{#hasNotifications}}
<a href="{{url}}" title="{{title}}"
id="secondary-button"
id="user-notifications"
class="notification-count user-button {{#hasUnseenNotifications}}notification-unseen{{/hasUnseenNotifications}}
{{#isNotificationCountZero}}zero{{/isNotificationCountZero}}">
<div class="circle">

View file

@ -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 );

View file

@ -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",

View file

@ -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',