jenkins-bot has submitted this change and it was merged.
Change subject: Fixed CPB flyout notification count
......................................................................
Fixed CPB flyout notification count
Added ext.echo.updateNotificationCount event handler to update CPB
notification count.
Bug: T67178
Change-Id: I14bdd87aec7e0d2ab4c137e3a5ef29c92636ef86
---
M resources/compactPersonalBar/compactPersonalBar.js
1 file changed, 16 insertions(+), 7 deletions(-)
Approvals:
Mattflaschen: Looks good to me, approved
Umherirrender: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/compactPersonalBar/compactPersonalBar.js
b/resources/compactPersonalBar/compactPersonalBar.js
index 1530e78..17e6304 100644
--- a/resources/compactPersonalBar/compactPersonalBar.js
+++ b/resources/compactPersonalBar/compactPersonalBar.js
@@ -112,19 +112,20 @@
};
$( function() {
- var $barContainer = $( '#p-personal' );
+ var $barContainer = $( '#p-personal' ),
+ $notifications = createItem( {
+ id: 'pt-notifications-flyout',
+ text: mw.msg( 'notifications' ),
+ count: $( '#pt-notifications' ).text(),
+ href: $( '#pt-notifications' ).find( 'a'
).attr( 'href' )
+ } );
menu.
addItem( 'heading', 'user-page', $( '#pt-userpage'
).find( 'a' ) ).
addItem( 'interactions', 'contributions', $(
'#pt-mycontris' ) ).
// notifications item can't be simply cloned, markup
has to be changed
// and label added
- addItem( 'interactions', 'notifications', createItem( {
- id: 'pt-notifications-flyout',
- text: mw.msg( 'notifications' ),
- count: $( '#pt-notifications' ).text(),
- href: $( '#pt-notifications' ).find( 'a'
).attr( 'href' )
- } ) ).
+ addItem( 'interactions', 'notifications',
$notifications ).
addItem( 'interactions', 'newmessages', $(
'#pt-newmessages' ).clone().attr( 'id', 'pt-newmessages-flyout' ) ).
addItem( 'interactions', 'talk', $( '#pt-mytalk'
).clone().attr( 'id', 'pt-mytalk-flyout' ) ).
addItem( 'interactions', 'watchlist', $(
'#pt-watchlist' ).clone().attr( 'id', 'pt-watchlist-flyout' ) ).
@@ -156,6 +157,14 @@
setTimeout( function() {
$barContainer.append( bar.$el );
}, 0 );
+
+ mw.hook( 'ext.echo.updateNotificationCount' ).add( function (
updateCount ) {
+ if ( updateCount !== 0 ) {
+ $notifications.find( 'span' ).show().text(
updateCount );
+ } else {
+ $notifications.find( 'span' ).hide();
+ }
+ } );
} );
}( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/190384
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I14bdd87aec7e0d2ab4c137e3a5ef29c92636ef86
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/VectorBeta
Gerrit-Branch: master
Gerrit-Owner: Phoenix303 <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jorm <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Phoenix303 <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits