]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/video-comments.ts
Block comments from muted accounts/servers
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / video-comments.ts
index 81c48412df8723276791bc396d6f5f11492b9e69..831e5e7d4f04c97d5e52019761d1b127bfac63b4 100644 (file)
@@ -61,6 +61,12 @@ function addVideoCommentReply (
     .expect(expectedStatus)
 }
 
+async function findCommentId (url: string, videoId: number | string, text: string) {
+  const res = await getVideoCommentThreads(url, videoId, 0, 25, '-createdAt')
+
+  return res.body.data.find(c => c.text === text).id as number
+}
+
 function deleteVideoComment (
   url: string,
   token: string,
@@ -85,5 +91,6 @@ export {
   getVideoThreadComments,
   addVideoCommentThread,
   addVideoCommentReply,
+  findCommentId,
   deleteVideoComment
 }