diff --git a/framework/core/js/src/common/models/User.js b/framework/core/js/src/common/models/User.js index b1d30b68c..4b7ef82b8 100644 --- a/framework/core/js/src/common/models/User.js +++ b/framework/core/js/src/common/models/User.js @@ -22,7 +22,7 @@ Object.assign(User.prototype, { joinTime: Model.attribute('joinTime', Model.transformDate), lastSeenAt: Model.attribute('lastSeenAt', Model.transformDate), markedAllAsReadAt: Model.attribute('markedAllAsReadAt', Model.transformDate), - unreadNotificationsCount: Model.attribute('unreadNotificationsCount'), + unreadNotificationCount: Model.attribute('unreadNotificationCount'), newNotificationsCount: Model.attribute('newNotificationsCount'), discussionCount: Model.attribute('discussionCount'), diff --git a/framework/core/js/src/forum/components/Notification.js b/framework/core/js/src/forum/components/Notification.js index 63d9d668d..0af3f9fec 100644 --- a/framework/core/js/src/forum/components/Notification.js +++ b/framework/core/js/src/forum/components/Notification.js @@ -79,7 +79,7 @@ export default class Notification extends Component { markAsRead() { if (this.props.notification.isRead()) return; - app.session.user.pushAttributes({unreadNotificationsCount: app.session.user.unreadNotificationsCount() - 1}); + app.session.user.pushAttributes({unreadNotificationCount: app.session.user.unreadNotificationCount() - 1}); this.props.notification.save({isRead: true}); } diff --git a/framework/core/js/src/forum/components/NotificationList.js b/framework/core/js/src/forum/components/NotificationList.js index 8d9d12488..12eb83c21 100644 --- a/framework/core/js/src/forum/components/NotificationList.js +++ b/framework/core/js/src/forum/components/NotificationList.js @@ -191,7 +191,7 @@ export default class NotificationList extends Component { markAllAsRead() { if (!app.cache.notifications) return; - app.session.user.pushAttributes({unreadNotificationsCount: 0}); + app.session.user.pushAttributes({unreadNotificationCount: 0}); app.cache.notifications.forEach(notifications => { notifications.forEach(notification => notification.pushAttributes({isRead: true})) diff --git a/framework/core/js/src/forum/components/NotificationsDropdown.js b/framework/core/js/src/forum/components/NotificationsDropdown.js index a8b716dfd..521e1d637 100644 --- a/framework/core/js/src/forum/components/NotificationsDropdown.js +++ b/framework/core/js/src/forum/components/NotificationsDropdown.js @@ -62,7 +62,7 @@ export default class NotificationsDropdown extends Dropdown { } getUnreadCount() { - return app.session.user.unreadNotificationsCount(); + return app.session.user.unreadNotificationCount(); } getNewCount() { diff --git a/framework/core/src/Api/Serializer/CurrentUserSerializer.php b/framework/core/src/Api/Serializer/CurrentUserSerializer.php index f947c5598..298361ce9 100644 --- a/framework/core/src/Api/Serializer/CurrentUserSerializer.php +++ b/framework/core/src/Api/Serializer/CurrentUserSerializer.php @@ -25,7 +25,7 @@ class CurrentUserSerializer extends UserSerializer 'isEmailConfirmed' => (bool) $user->is_email_confirmed, 'email' => $user->email, 'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at), - 'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(), + 'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(), 'newNotificationsCount' => (int) $user->getNewNotificationsCount(), 'preferences' => (array) $user->preferences ]; diff --git a/framework/core/src/User/User.php b/framework/core/src/User/User.php index d43a3224c..418db5874 100644 --- a/framework/core/src/User/User.php +++ b/framework/core/src/User/User.php @@ -417,7 +417,7 @@ class User extends AbstractModel * * @return int */ - public function getUnreadNotificationsCount() + public function getUnreadNotificationCount() { return $this->getUnreadNotifications()->count(); }