mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Rename user.unreadNotificationsCount
This commit is contained in:
parent
f9bab0822e
commit
eb5b3a0484
|
@ -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'),
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
|
|
|
@ -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}))
|
||||
|
|
|
@ -62,7 +62,7 @@ export default class NotificationsDropdown extends Dropdown {
|
|||
}
|
||||
|
||||
getUnreadCount() {
|
||||
return app.session.user.unreadNotificationsCount();
|
||||
return app.session.user.unreadNotificationCount();
|
||||
}
|
||||
|
||||
getNewCount() {
|
||||
|
|
|
@ -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
|
||||
];
|
||||
|
|
|
@ -417,7 +417,7 @@ class User extends AbstractModel
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getUnreadNotificationsCount()
|
||||
public function getUnreadNotificationCount()
|
||||
{
|
||||
return $this->getUnreadNotifications()->count();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user