diff --git a/js/src/common/components/Navigation.js b/js/src/common/components/Navigation.js index f9c752574..77f52995c 100644 --- a/js/src/common/components/Navigation.js +++ b/js/src/common/components/Navigation.js @@ -95,7 +95,7 @@ export default class Navigation extends Component { return Button.component({ className: 'Button Button--icon Navigation-drawer' + - (user && user.newNotificationsCount() ? ' new' : ''), + (user && user.newNotificationCount() ? ' new' : ''), onclick: e => { e.stopPropagation(); drawer.show(); diff --git a/js/src/common/models/User.js b/js/src/common/models/User.js index 4b7ef82b8..d9754606f 100644 --- a/js/src/common/models/User.js +++ b/js/src/common/models/User.js @@ -23,7 +23,7 @@ Object.assign(User.prototype, { lastSeenAt: Model.attribute('lastSeenAt', Model.transformDate), markedAllAsReadAt: Model.attribute('markedAllAsReadAt', Model.transformDate), unreadNotificationCount: Model.attribute('unreadNotificationCount'), - newNotificationsCount: Model.attribute('newNotificationsCount'), + newNotificationCount: Model.attribute('newNotificationCount'), discussionCount: Model.attribute('discussionCount'), commentCount: Model.attribute('commentCount'), diff --git a/js/src/forum/components/NotificationList.js b/js/src/forum/components/NotificationList.js index 12eb83c21..eebd8032b 100644 --- a/js/src/forum/components/NotificationList.js +++ b/js/src/forum/components/NotificationList.js @@ -137,7 +137,7 @@ export default class NotificationList extends Component { * been loaded. */ load() { - if (app.session.user.newNotificationsCount()) { + if (app.session.user.newNotificationCount()) { delete app.cache.notifications; } @@ -145,7 +145,7 @@ export default class NotificationList extends Component { return; } - app.session.user.pushAttributes({newNotificationsCount: 0}); + app.session.user.pushAttributes({newNotificationCount: 0}); this.loadMore(); } diff --git a/js/src/forum/components/NotificationsDropdown.js b/js/src/forum/components/NotificationsDropdown.js index 521e1d637..d185c4a5f 100644 --- a/js/src/forum/components/NotificationsDropdown.js +++ b/js/src/forum/components/NotificationsDropdown.js @@ -66,7 +66,7 @@ export default class NotificationsDropdown extends Dropdown { } getNewCount() { - return app.session.user.newNotificationsCount(); + return app.session.user.newNotificationCount(); } menuClick(e) { diff --git a/src/Api/Serializer/CurrentUserSerializer.php b/src/Api/Serializer/CurrentUserSerializer.php index 298361ce9..cea92bca2 100644 --- a/src/Api/Serializer/CurrentUserSerializer.php +++ b/src/Api/Serializer/CurrentUserSerializer.php @@ -26,7 +26,7 @@ class CurrentUserSerializer extends UserSerializer 'email' => $user->email, 'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at), 'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(), - 'newNotificationsCount' => (int) $user->getNewNotificationsCount(), + 'newNotificationCount' => (int) $user->getNewNotificationCount(), 'preferences' => (array) $user->preferences ]; diff --git a/src/User/User.php b/src/User/User.php index 418db5874..fb999ad95 100644 --- a/src/User/User.php +++ b/src/User/User.php @@ -447,7 +447,7 @@ class User extends AbstractModel * * @return int */ - public function getNewNotificationsCount() + public function getNewNotificationCount() { return $this->getUnreadNotifications()->filter(function ($notification) { return $notification->created_at > $this->read_notifications_at ?: 0;