diff options
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test-four/main.js')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-four/main.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/server/tests/fixtures/peertube-plugin-test-four/main.js index 9abb73646..2e81550c1 100644 --- a/server/tests/fixtures/peertube-plugin-test-four/main.js +++ b/server/tests/fixtures/peertube-plugin-test-four/main.js | |||
@@ -1,7 +1,10 @@ | |||
1 | async function register ({ | 1 | async function register ({ |
2 | peertubeHelpers | 2 | peertubeHelpers, |
3 | registerHook | ||
3 | }) { | 4 | }) { |
4 | peertubeHelpers.logger.info('Hello world from plugin four') | 5 | const logger = peertubeHelpers.logger |
6 | |||
7 | logger.info('Hello world from plugin four') | ||
5 | 8 | ||
6 | const username = 'root' | 9 | const username = 'root' |
7 | const results = await peertubeHelpers.database.query( | 10 | const results = await peertubeHelpers.database.query( |
@@ -12,7 +15,16 @@ async function register ({ | |||
12 | } | 15 | } |
13 | ) | 16 | ) |
14 | 17 | ||
15 | peertubeHelpers.logger.info('root email is ' + results[0]['email']) | 18 | logger.info('root email is ' + results[0]['email']) |
19 | |||
20 | registerHook({ | ||
21 | target: 'action:api.video.viewed', | ||
22 | handler: async ({ video }) => { | ||
23 | await peertubeHelpers.videos.removeVideo(video.id) | ||
24 | |||
25 | logger.info('Video deleted by plugin four.') | ||
26 | } | ||
27 | }) | ||
16 | } | 28 | } |
17 | 29 | ||
18 | async function unregister () { | 30 | async function unregister () { |