Convert some local functions to arrow functions

Change-Id: Ib16745cea5502e296d05255ec836c24779aeca64
This commit is contained in:
Ed Sanders 2024-06-13 16:15:19 +01:00
parent 45ba7840da
commit 83024319a4
4 changed files with 8 additions and 31 deletions

View file

@ -88,10 +88,7 @@
* @return {boolean} There are unseen items
*/
mw.echo.dm.BundleNotificationItem.prototype.hasUnseen = function () {
const isUnseen = function ( item ) {
return !item.isSeen();
};
return this.list.getItems().some( isUnseen );
return this.list.getItems().some( ( item ) => !item.isSeen() );
};
/**

View file

@ -279,11 +279,7 @@
* @return {boolean} Local model has unread notifications.
*/
mw.echo.dm.ModelManager.prototype.hasLocalUnread = function () {
const isUnread = function ( item ) {
return !item.isRead();
};
return this.getLocalNotifications().some( isUnread );
return this.getLocalNotifications().some( ( item ) => !item.isRead() );
};
/**
@ -292,11 +288,7 @@
* @return {mw.echo.dm.NotificationItem[]} Local unread notifications
*/
mw.echo.dm.ModelManager.prototype.getLocalUnread = function () {
const isUnread = function ( item ) {
return !item.isRead();
};
return this.getLocalNotifications().filter( isUnread );
return this.getLocalNotifications().filter( ( item ) => !item.isRead() );
};
/**
* Check whether there are talk notifications, and emit an event
@ -316,11 +308,9 @@
* @return {boolean} Local model has unread talk page notifications.
*/
mw.echo.dm.ModelManager.prototype.hasLocalUnreadTalk = function () {
const isUnreadUserTalk = function ( item ) {
return !item.isRead() && item.getCategory() === 'edit-user-talk';
};
return this.getLocalNotifications().some( isUnreadUserTalk );
return this.getLocalNotifications().some(
( item ) => !item.isRead() && item.getCategory() === 'edit-user-talk'
);
};
/**

View file

@ -233,12 +233,7 @@
* @return {boolean} There are unseen items in the list
*/
mw.echo.dm.NotificationsList.prototype.hasUnseen = function () {
const isItemUnseen = function ( item ) {
return !item.isSeen();
},
items = this.getItems();
return !!items.some( isItemUnseen );
return this.getItems().some( ( item ) => !item.isSeen() );
};
/**

View file

@ -178,12 +178,7 @@
* @return {boolean} Sub group has unread notifications
*/
mw.echo.ui.SubGroupListWidget.prototype.hasUnread = function () {
const isUnread = function ( item ) {
return !item.isRead();
},
items = this.model.getItems();
return items.some( isUnread );
return this.model.getItems().some( ( item ) => !item.isRead() );
};
/**