aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r--shared/extra-utils/videos/video-comments.ts7
-rw-r--r--shared/extra-utils/videos/videos.ts9
2 files changed, 15 insertions, 1 deletions
diff --git a/shared/extra-utils/videos/video-comments.ts b/shared/extra-utils/videos/video-comments.ts
index 81c48412d..831e5e7d4 100644
--- a/shared/extra-utils/videos/video-comments.ts
+++ b/shared/extra-utils/videos/video-comments.ts
@@ -61,6 +61,12 @@ function addVideoCommentReply (
61 .expect(expectedStatus) 61 .expect(expectedStatus)
62} 62}
63 63
64async function findCommentId (url: string, videoId: number | string, text: string) {
65 const res = await getVideoCommentThreads(url, videoId, 0, 25, '-createdAt')
66
67 return res.body.data.find(c => c.text === text).id as number
68}
69
64function deleteVideoComment ( 70function deleteVideoComment (
65 url: string, 71 url: string,
66 token: string, 72 token: string,
@@ -85,5 +91,6 @@ export {
85 getVideoThreadComments, 91 getVideoThreadComments,
86 addVideoCommentThread, 92 addVideoCommentThread,
87 addVideoCommentReply, 93 addVideoCommentReply,
94 findCommentId,
88 deleteVideoComment 95 deleteVideoComment
89} 96}
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 0d36a38a2..99e591cb2 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -95,6 +95,12 @@ function getVideo (url: string, id: number | string, expectedStatus = 200) {
95 .expect(expectedStatus) 95 .expect(expectedStatus)
96} 96}
97 97
98async function getVideoIdFromUUID (url: string, uuid: string) {
99 const res = await getVideo(url, uuid)
100
101 return res.body.id
102}
103
98function getVideoFileMetadataUrl (url: string) { 104function getVideoFileMetadataUrl (url: string) {
99 return request(url) 105 return request(url)
100 .get('/') 106 .get('/')
@@ -669,5 +675,6 @@ export {
669 checkVideoFilesWereRemoved, 675 checkVideoFilesWereRemoved,
670 getPlaylistVideos, 676 getPlaylistVideos,
671 uploadVideoAndGetId, 677 uploadVideoAndGetId,
672 getLocalIdByUUID 678 getLocalIdByUUID,
679 getVideoIdFromUUID
673} 680}