mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 09:40:41 +00:00
Don't clear notifications when refetching
Make the popup header the pending element to give the user a visual indication that the notification widget is being updated, but don't clear the notifications before loading more from the database. Bug: T112186 Change-Id: If2b724fab07ef5b7caf5cab3e44fe326470ac0e7
This commit is contained in:
parent
957c2b0c98
commit
b1b9b6e257
|
@ -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
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
}
|
||||
|
||||
.oo-ui-popupWidget-head {
|
||||
height: 3.5em;
|
||||
> .oo-ui-iconWidget {
|
||||
float: left;
|
||||
margin: 0.7em 0 1em 1em;
|
||||
|
|
|
@ -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;
|
||||
} )
|
||||
|
|
Loading…
Reference in a new issue