Rename user.unreadNotificationsCount

This commit is contained in:
Toby Zerner 2018-08-24 21:36:33 +09:30
parent f9bab0822e
commit eb5b3a0484
6 changed files with 6 additions and 6 deletions

View File

@ -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'),

View File

@ -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});
}

View File

@ -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}))

View File

@ -62,7 +62,7 @@ export default class NotificationsDropdown extends Dropdown {
}
getUnreadCount() {
return app.session.user.unreadNotificationsCount();
return app.session.user.unreadNotificationCount();
}
getNewCount() {

View File

@ -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
];

View File

@ -417,7 +417,7 @@ class User extends AbstractModel
*
* @return int
*/
public function getUnreadNotificationsCount()
public function getUnreadNotificationCount()
{
return $this->getUnreadNotifications()->count();
}