From 6559da2821cfa37717fb6f607f76a505d549cc74 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Feb 2021 10:23:52 +0100 Subject: Allow plugins to load a video by id --- server/tests/fixtures/peertube-plugin-test-four/main.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/server/tests/fixtures/peertube-plugin-test-four/main.js index 067c3fe15..8df456c8a 100644 --- a/server/tests/fixtures/peertube-plugin-test-four/main.js +++ b/server/tests/fixtures/peertube-plugin-test-four/main.js @@ -24,8 +24,13 @@ async function register ({ registerHook({ target: 'action:api.video.viewed', handler: async ({ video }) => { - const videoFromDB = await peertubeHelpers.videos.loadByUrl(video.url) - logger.info('video from DB uuid is %s.', videoFromDB.uuid) + const videoFromDB1 = await peertubeHelpers.videos.loadByUrl(video.url) + const videoFromDB2 = await peertubeHelpers.videos.loadByIdOrUUID(video.id) + const videoFromDB3 = await peertubeHelpers.videos.loadByIdOrUUID(video.uuid) + + if (videoFromDB1.uuid !== videoFromDB2.uuid || videoFromDB2.uuid !== videoFromDB3.uuid) return + + logger.info('video from DB uuid is %s.', videoFromDB1.uuid) await peertubeHelpers.videos.removeVideo(video.id) -- cgit v1.2.3