mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 16:23:40 +08:00
Rename user.readTime
This commit is contained in:
parent
70058652b5
commit
d8d2de438f
|
@ -67,7 +67,7 @@ Object.assign(Discussion.prototype, {
|
|||
unreadCount() {
|
||||
const user = app.session.user;
|
||||
|
||||
if (user && user.readTime() < this.lastPostedAt()) {
|
||||
if (user && user.markedAllAsReadAt() < this.lastPostedAt()) {
|
||||
return Math.max(0, this.lastPostNumber() - (this.lastReadPostNumber() || 0));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ Object.assign(User.prototype, {
|
|||
|
||||
joinTime: Model.attribute('joinTime', Model.transformDate),
|
||||
lastSeenAt: Model.attribute('lastSeenAt', Model.transformDate),
|
||||
readTime: Model.attribute('readTime', Model.transformDate),
|
||||
markedAllAsReadAt: Model.attribute('markedAllAsReadAt', Model.transformDate),
|
||||
unreadNotificationsCount: Model.attribute('unreadNotificationsCount'),
|
||||
newNotificationsCount: Model.attribute('newNotificationsCount'),
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ export default class DiscussionListItem extends Component {
|
|||
this.subtree = new SubtreeRetainer(
|
||||
() => this.props.discussion.freshness,
|
||||
() => {
|
||||
const time = app.session.user && app.session.user.readTime();
|
||||
const time = app.session.user && app.session.user.markedAllAsReadAt();
|
||||
return time && time.getTime();
|
||||
},
|
||||
() => this.active()
|
||||
|
|
|
@ -385,7 +385,7 @@ export default class IndexPage extends Page {
|
|||
const confirmation = confirm(app.translator.trans('core.forum.index.mark_all_as_read_confirmation'));
|
||||
|
||||
if (confirmation) {
|
||||
app.session.user.save({readTime: new Date()});
|
||||
app.session.user.save({markedAllAsReadAt: new Date()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class CurrentUserSerializer extends UserSerializer
|
|||
$attributes += [
|
||||
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
|
||||
'email' => $user->email,
|
||||
'readTime' => $this->formatDate($user->marked_all_as_read_at),
|
||||
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
|
||||
'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
|
||||
'newNotificationsCount' => (int) $user->getNewNotificationsCount(),
|
||||
'preferences' => (array) $user->preferences
|
||||
|
|
|
@ -114,7 +114,7 @@ class EditUserHandler
|
|||
$validate['password'] = $attributes['password'];
|
||||
}
|
||||
|
||||
if (! empty($attributes['readTime'])) {
|
||||
if (! empty($attributes['markedAllAsReadAt'])) {
|
||||
$this->assertPermission($isSelf);
|
||||
$user->markAllAsRead();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user