import { pick } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class CommentsCommand extends AbstractCommand {
+ private lastVideoId: number | string
+ private lastThreadId: number
+ private lastReplyId: number
+
listForAdmin (options: OverrideCommandOptions & {
start?: number
count?: number
defaultExpectedStatus: HttpStatusCode.OK_200
}))
+ this.lastThreadId = body.comment?.id
+ this.lastVideoId = videoId
+
return body.comment
}
defaultExpectedStatus: HttpStatusCode.OK_200
}))
+ this.lastReplyId = body.comment?.id
+
return body.comment
}
+ async addReplyToLastReply (options: OverrideCommandOptions & {
+ text: string
+ }) {
+ return this.addReply({ ...options, videoId: this.lastVideoId, toCommentId: this.lastReplyId })
+ }
+
+ async addReplyToLastThread (options: OverrideCommandOptions & {
+ text: string
+ }) {
+ return this.addReply({ ...options, videoId: this.lastVideoId, toCommentId: this.lastThreadId })
+ }
+
async findCommentId (options: OverrideCommandOptions & {
videoId: number | string
text: string