diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js index caeb795f3..037e57c1e 100644 --- a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js +++ b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js @@ -58,8 +58,6 @@ } ); - this.setPendingElement( this.notificationsWidget.$element ); - // Footer allNotificationsButton = new OO.ui.ButtonWidget( { framed: false, @@ -106,6 +104,8 @@ this.updateIcon( !!config.hasUnseen ); + this.setPendingElement( this.popup.$head ); + // Mark all as read button this.markAllReadButton = new OO.ui.ButtonWidget( { framed: false, @@ -199,9 +199,6 @@ if ( !this.notificationsModel.isFetchingNotifications() ) { if ( this.hasRunFirstTime ) { - // Don't clear items on the first time we open the popup - this.notificationsModel.clearItems(); - // HACK: Clippable doesn't resize the clippable area when // it calculates the new size. Since the popup contents changed // and the popup is "empty" now, we need to manually set its diff --git a/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less b/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less index ad214e1d1..d705a8aa7 100644 --- a/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less +++ b/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less @@ -66,6 +66,7 @@ } .oo-ui-popupWidget-head { + height: 3.5em; > .oo-ui-iconWidget { float: left; margin: 0.7em 0 1em 1em; diff --git a/modules/viewmodel/mw.echo.dm.NotificationsModel.js b/modules/viewmodel/mw.echo.dm.NotificationsModel.js index ed69a4386..1a090db65 100644 --- a/modules/viewmodel/mw.echo.dm.NotificationsModel.js +++ b/modules/viewmodel/mw.echo.dm.NotificationsModel.js @@ -269,6 +269,10 @@ for ( i = 0, len = data.index.length; i < len; i++ ) { notifData = data.list[ data.index[i] ]; + if ( model.getItemById( notifData.id ) ) { + // Skip if we already have the item + continue; + } // TODO: This should really be formatted better, and the OptionWidget // should be the one that displays whatever icon relates to this notification // according to its type. @@ -292,7 +296,7 @@ idArray.push( notifData.id ); optionItems.push( notificationModel ); } - model.addItems( optionItems ); + model.addItems( optionItems, 0 ); return idArray; } )