aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/comments-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-20 14:15:15 +0200
committerChocobozzz <me@florianbigard.com>2021-07-21 13:35:31 +0200
commit4d029ef8ec3d5274eeaa3ee6d808eb7035e7faef (patch)
tree20bcdd660ab4eb731814db3a4a40fffb48ce7482 /shared/extra-utils/videos/comments-command.ts
parent7f28f2ddbaeecf451d501e99ded0408c14a33600 (diff)
downloadPeerTube-4d029ef8ec3d5274eeaa3ee6d808eb7035e7faef.tar.gz
PeerTube-4d029ef8ec3d5274eeaa3ee6d808eb7035e7faef.tar.zst
PeerTube-4d029ef8ec3d5274eeaa3ee6d808eb7035e7faef.zip
Add ability for instances to follow any actor
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