1
0
mirror of https://github.com/flarum/core.git synced 2025-07-25 02:31:17 +02:00

Return both unread and new notification count from the API

Related to #500.
This commit is contained in:
Franz Liedke
2015-09-29 01:26:28 +02:00
parent e4b90296bc
commit 0bef17149c
4 changed files with 38 additions and 11 deletions

View File

@@ -70,13 +70,11 @@ export default class NotificationsDropdown extends Dropdown {
}
getUnreadCount() {
return app.cache.notifications ?
app.cache.notifications.filter(notification => !notification.isRead()).length :
0;
return app.session.user.unreadNotificationsCount();
}
getNewCount() {
return app.session.user.unreadNotificationsCount();
return app.session.user.newNotificationsCount();
}
menuClick(e) {

View File

@@ -23,6 +23,7 @@ export default class User extends mixin(Model, {
lastSeenTime: Model.attribute('lastSeenTime', Model.transformDate),
readTime: Model.attribute('readTime', Model.transformDate),
unreadNotificationsCount: Model.attribute('unreadNotificationsCount'),
newNotificationsCount: Model.attribute('newNotificationsCount'),
discussionsCount: Model.attribute('discussionsCount'),
commentsCount: Model.attribute('commentsCount'),