import { CONSTRAINTS_FIELDS } from '../../initializers'
import { AccountModel } from '../account/account'
import { ActorModel } from '../activitypub/actor'
+import { AvatarModel } from '../avatar/avatar'
import { ServerModel } from '../server/server'
import { getSort, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
{
model: () => ServerModel,
required: false
+ },
+ {
+ model: () => AvatarModel,
+ required: false
}
]
}
static listThreadCommentsForApi (videoId: number, threadId: number) {
const query = {
- order: [ [ 'id', 'ASC' ] ],
+ order: [ [ 'createdAt', 'ASC' ] ],
where: {
videoId,
[ Sequelize.Op.or ]: [
createdAt: this.createdAt,
updatedAt: this.updatedAt,
totalReplies: this.get('totalReplies') || 0,
- account: {
- name: this.Account.name,
- host: this.Account.Actor.getHost()
- }
+ account: this.Account.toFormattedJSON()
} as VideoComment
}