aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/fixtures')
-rw-r--r--server/tests/fixtures/peertube-plugin-test/main.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js
index a45e98fb5..322c0610c 100644
--- a/server/tests/fixtures/peertube-plugin-test/main.js
+++ b/server/tests/fixtures/peertube-plugin-test/main.js
@@ -7,6 +7,8 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
7 'action:api.video.uploaded', 7 'action:api.video.uploaded',
8 'action:api.video.viewed', 8 'action:api.video.viewed',
9 9
10 'action:api.live-video.created',
11
10 'action:api.video-thread.created', 12 'action:api.video-thread.created',
11 'action:api.video-comment-reply.created', 13 'action:api.video-comment-reply.created',
12 'action:api.video-comment.deleted', 14 'action:api.video-comment.deleted',
@@ -46,15 +48,22 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
46 } 48 }
47 }) 49 })
48 50
49 registerHook({ 51 for (const hook of [ 'filter:api.video.upload.accept.result', 'filter:api.live-video.create.accept.result' ]) {
50 target: 'filter:api.video.upload.accept.result', 52 registerHook({
51 handler: ({ accepted }, { videoBody }) => { 53 target: hook,
52 if (!accepted) return { accepted: false } 54 handler: ({ accepted }, { videoBody, liveVideoBody }) => {
53 if (videoBody.name.indexOf('bad word') !== -1) return { accepted: false, errorMessage: 'bad word' } 55 if (!accepted) return { accepted: false }
54 56
55 return { accepted: true } 57 const name = videoBody
56 } 58 ? videoBody.name
57 }) 59 : liveVideoBody.name
60
61 if (name.indexOf('bad word') !== -1) return { accepted: false, errorMessage: 'bad word' }
62
63 return { accepted: true }
64 }
65 })
66 }
58 67
59 registerHook({ 68 registerHook({
60 target: 'filter:api.video.pre-import-url.accept.result', 69 target: 'filter:api.video.pre-import-url.accept.result',