diff --git a/js/src/common/models/Discussion.js b/js/src/common/models/Discussion.js index 26b5f7ec1..344151f30 100644 --- a/js/src/common/models/Discussion.js +++ b/js/src/common/models/Discussion.js @@ -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)); } diff --git a/js/src/common/models/User.js b/js/src/common/models/User.js index d822307ea..b1d30b68c 100644 --- a/js/src/common/models/User.js +++ b/js/src/common/models/User.js @@ -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'), diff --git a/js/src/forum/components/DiscussionListItem.js b/js/src/forum/components/DiscussionListItem.js index ca4910d86..d11abf4f8 100644 --- a/js/src/forum/components/DiscussionListItem.js +++ b/js/src/forum/components/DiscussionListItem.js @@ -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() diff --git a/js/src/forum/components/IndexPage.js b/js/src/forum/components/IndexPage.js index bfe24de0b..16648663c 100644 --- a/js/src/forum/components/IndexPage.js +++ b/js/src/forum/components/IndexPage.js @@ -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()}); } } } diff --git a/src/Api/Serializer/CurrentUserSerializer.php b/src/Api/Serializer/CurrentUserSerializer.php index 9e88aeff9..f947c5598 100644 --- a/src/Api/Serializer/CurrentUserSerializer.php +++ b/src/Api/Serializer/CurrentUserSerializer.php @@ -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 diff --git a/src/User/Command/EditUserHandler.php b/src/User/Command/EditUserHandler.php index 65622990c..6d9d2485d 100644 --- a/src/User/Command/EditUserHandler.php +++ b/src/User/Command/EditUserHandler.php @@ -114,7 +114,7 @@ class EditUserHandler $validate['password'] = $attributes['password']; } - if (! empty($attributes['readTime'])) { + if (! empty($attributes['markedAllAsReadAt'])) { $this->assertPermission($isSelf); $user->markAllAsRead(); }