Rename user.readTime

This commit is contained in:
Toby Zerner 2018-08-24 21:35:46 +09:30
parent 70058652b5
commit d8d2de438f
6 changed files with 6 additions and 6 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -114,7 +114,7 @@ class EditUserHandler
$validate['password'] = $attributes['password'];
}
if (! empty($attributes['readTime'])) {
if (! empty($attributes['markedAllAsReadAt'])) {
$this->assertPermission($isSelf);
$user->markAllAsRead();
}