Rename discussion.lastTime

This commit is contained in:
Toby Zerner 2018-08-24 20:49:06 +09:30
parent 568006fe73
commit 1e9d9b8322
3 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ Object.assign(Discussion.prototype, {
user: Model.hasOne('user'),
firstPost: Model.hasOne('firstPost'),
lastTime: Model.attribute('lastTime', Model.transformDate),
lastPostedAt: Model.attribute('lastPostedAt', Model.transformDate),
lastPostedUser: Model.hasOne('lastPostedUser'),
lastPost: Model.hasOne('lastPost'),
lastPostNumber: Model.attribute('lastPostNumber'),
@ -67,7 +67,7 @@ Object.assign(Discussion.prototype, {
unreadCount() {
const user = app.session.user;
if (user && user.readTime() < this.lastTime()) {
if (user && user.readTime() < this.lastPostedAt()) {
return Math.max(0, this.lastPostNumber() - (this.readNumber() || 0));
}

View File

@ -16,7 +16,7 @@ export default class TerminalPost extends Component {
const lastPost = this.props.lastPost && discussion.repliesCount();
const user = discussion[lastPost ? 'lastPostedUser' : 'user']();
const time = discussion[lastPost ? 'lastTime' : 'createdAt']();
const time = discussion[lastPost ? 'lastPostedAt' : 'createdAt']();
return (
<span>

View File

@ -40,7 +40,7 @@ class DiscussionSerializer extends BasicDiscussionSerializer
'commentCount' => (int) $discussion->comment_count,
'participantCount' => (int) $discussion->participant_count,
'createdAt' => $this->formatDate($discussion->created_at),
'lastTime' => $this->formatDate($discussion->last_posted_at),
'lastPostedAt' => $this->formatDate($discussion->last_posted_at),
'lastPostNumber' => (int) $discussion->last_post_number,
'canReply' => $gate->allows('reply', $discussion),
'canRename' => $gate->allows('rename', $discussion),