mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 22:44:54 +08:00
Rename user.newNotificationsCount
This commit is contained in:
parent
37ffd04b3f
commit
ce39bc9070
|
@ -95,7 +95,7 @@ export default class Navigation extends Component {
|
||||||
|
|
||||||
return Button.component({
|
return Button.component({
|
||||||
className: 'Button Button--icon Navigation-drawer' +
|
className: 'Button Button--icon Navigation-drawer' +
|
||||||
(user && user.newNotificationsCount() ? ' new' : ''),
|
(user && user.newNotificationCount() ? ' new' : ''),
|
||||||
onclick: e => {
|
onclick: e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
drawer.show();
|
drawer.show();
|
||||||
|
|
|
@ -23,7 +23,7 @@ Object.assign(User.prototype, {
|
||||||
lastSeenAt: Model.attribute('lastSeenAt', Model.transformDate),
|
lastSeenAt: Model.attribute('lastSeenAt', Model.transformDate),
|
||||||
markedAllAsReadAt: Model.attribute('markedAllAsReadAt', Model.transformDate),
|
markedAllAsReadAt: Model.attribute('markedAllAsReadAt', Model.transformDate),
|
||||||
unreadNotificationCount: Model.attribute('unreadNotificationCount'),
|
unreadNotificationCount: Model.attribute('unreadNotificationCount'),
|
||||||
newNotificationsCount: Model.attribute('newNotificationsCount'),
|
newNotificationCount: Model.attribute('newNotificationCount'),
|
||||||
|
|
||||||
discussionCount: Model.attribute('discussionCount'),
|
discussionCount: Model.attribute('discussionCount'),
|
||||||
commentCount: Model.attribute('commentCount'),
|
commentCount: Model.attribute('commentCount'),
|
||||||
|
|
|
@ -137,7 +137,7 @@ export default class NotificationList extends Component {
|
||||||
* been loaded.
|
* been loaded.
|
||||||
*/
|
*/
|
||||||
load() {
|
load() {
|
||||||
if (app.session.user.newNotificationsCount()) {
|
if (app.session.user.newNotificationCount()) {
|
||||||
delete app.cache.notifications;
|
delete app.cache.notifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ export default class NotificationList extends Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.session.user.pushAttributes({newNotificationsCount: 0});
|
app.session.user.pushAttributes({newNotificationCount: 0});
|
||||||
|
|
||||||
this.loadMore();
|
this.loadMore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ export default class NotificationsDropdown extends Dropdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
getNewCount() {
|
getNewCount() {
|
||||||
return app.session.user.newNotificationsCount();
|
return app.session.user.newNotificationCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
menuClick(e) {
|
menuClick(e) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ class CurrentUserSerializer extends UserSerializer
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
|
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
|
||||||
'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(),
|
'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(),
|
||||||
'newNotificationsCount' => (int) $user->getNewNotificationsCount(),
|
'newNotificationCount' => (int) $user->getNewNotificationCount(),
|
||||||
'preferences' => (array) $user->preferences
|
'preferences' => (array) $user->preferences
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -447,7 +447,7 @@ class User extends AbstractModel
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getNewNotificationsCount()
|
public function getNewNotificationCount()
|
||||||
{
|
{
|
||||||
return $this->getUnreadNotifications()->filter(function ($notification) {
|
return $this->getUnreadNotifications()->filter(function ($notification) {
|
||||||
return $notification->created_at > $this->read_notifications_at ?: 0;
|
return $notification->created_at > $this->read_notifications_at ?: 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user