mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 05:32:49 +08:00
Rename discussion.lastTime
This commit is contained in:
parent
568006fe73
commit
1e9d9b8322
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue
Block a user