aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/comments-command.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/videos/comments-command.ts')
-rw-r--r--shared/extra-utils/videos/comments-command.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts
index dd14e4b64..5034c57ad 100644
--- a/shared/extra-utils/videos/comments-command.ts
+++ b/shared/extra-utils/videos/comments-command.ts
@@ -5,6 +5,10 @@ import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 5
6export class CommentsCommand extends AbstractCommand { 6export class CommentsCommand extends AbstractCommand {
7 7
8 private lastVideoId: number | string
9 private lastThreadId: number
10 private lastReplyId: number
11
8 listForAdmin (options: OverrideCommandOptions & { 12 listForAdmin (options: OverrideCommandOptions & {
9 start?: number 13 start?: number
10 count?: number 14 count?: number
@@ -80,6 +84,9 @@ export class CommentsCommand extends AbstractCommand {
80 defaultExpectedStatus: HttpStatusCode.OK_200 84 defaultExpectedStatus: HttpStatusCode.OK_200
81 })) 85 }))
82 86
87 this.lastThreadId = body.comment.id
88 this.lastVideoId = videoId
89
83 return body.comment 90 return body.comment
84 } 91 }
85 92
@@ -100,9 +107,23 @@ export class CommentsCommand extends AbstractCommand {
100 defaultExpectedStatus: HttpStatusCode.OK_200 107 defaultExpectedStatus: HttpStatusCode.OK_200
101 })) 108 }))
102 109
110 this.lastReplyId = body.comment.id
111
103 return body.comment 112 return body.comment
104 } 113 }
105 114
115 async addReplyToLastReply (options: OverrideCommandOptions & {
116 text: string
117 }) {
118 return this.addReply({ ...options, videoId: this.lastVideoId, toCommentId: this.lastReplyId })
119 }
120
121 async addReplyToLastThread (options: OverrideCommandOptions & {
122 text: string
123 }) {
124 return this.addReply({ ...options, videoId: this.lastVideoId, toCommentId: this.lastThreadId })
125 }
126
106 async findCommentId (options: OverrideCommandOptions & { 127 async findCommentId (options: OverrideCommandOptions & {
107 videoId: number | string 128 videoId: number | string
108 text: string 129 text: string