mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 01:10:07 +00:00
Properly aggregate the itemUpdate event
Instead of 'cheating' and externally aggregating the itemUpdate event we should just let the relevant (non-xwiki) models aggregate this centrally and properly, and include it as an offered event. Change-Id: Ibe528fe971e1be8309a97275b1a1be8979306ff5
This commit is contained in:
parent
ebd616d6f3
commit
5c81ac8d3b
|
@ -36,7 +36,6 @@
|
|||
this.list = new mw.echo.dm.NotificationsList();
|
||||
this.list.setItems( bundledNotificationModels );
|
||||
|
||||
this.list.aggregate( { update: 'itemUpdate' } );
|
||||
this.list.connect( this, { itemUpdate: 'onItemUpdate' } );
|
||||
|
||||
// For bundles, 'read' is a computed state based on
|
||||
|
|
|
@ -112,7 +112,6 @@
|
|||
|
||||
localModel = this.getNotificationModel( 'local' );
|
||||
if ( localModel ) {
|
||||
localModel.aggregate( { update: 'itemUpdate' } );
|
||||
localModel.connect( this, { itemUpdate: 'checkLocalUnreadTalk' } );
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
// Fallback on IDs
|
||||
return b.getId() - a.getId();
|
||||
} );
|
||||
|
||||
// Events
|
||||
this.aggregate( { update: 'itemUpdate' } );
|
||||
};
|
||||
|
||||
/* Initialization */
|
||||
|
@ -69,6 +72,13 @@
|
|||
* The list has been updated
|
||||
*/
|
||||
|
||||
/**
|
||||
* @event itemUpdate
|
||||
* @param {mw.echo.dm.NotificationItem} item Item that has changed
|
||||
*
|
||||
* An item in the list has been updated
|
||||
*/
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,9 +85,6 @@
|
|||
// Update all items
|
||||
update: 'resetItemsFromModel'
|
||||
} );
|
||||
// We must aggregate on item update, so we know when and if all
|
||||
// items are read and can hide/show the 'mark all read' button
|
||||
this.model.aggregate( { update: 'itemUpdate' } );
|
||||
this.model.connect( this, { itemUpdate: 'toggleMarkAllReadButton' } );
|
||||
this.markAllReadButton.connect( this, { click: 'onMarkAllReadButtonClick' } );
|
||||
|
||||
|
|
Loading…
Reference in a new issue