aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures
diff options
context:
space:
mode:
authorlutangar <johan.dufour@gmail.com>2021-06-29 16:02:05 +0200
committerlutangar <johan.dufour@gmail.com>2021-07-16 17:49:40 +0200
commitdc3d902234bb73fbc8cf9787e3036f2012526e6c (patch)
tree58ab2812fa5b38f4e19376f1a7cf3d718f3003fb /server/tests/fixtures
parentde15b052c59cbd4b99bca835b124485ca1af399e (diff)
downloadPeerTube-dc3d902234bb73fbc8cf9787e3036f2012526e6c.tar.gz
PeerTube-dc3d902234bb73fbc8cf9787e3036f2012526e6c.tar.zst
PeerTube-dc3d902234bb73fbc8cf9787e3036f2012526e6c.zip
Introduce generic video constant manager for plugins
Allow a plugin developer to get back constants values, and reset constants deletions or additions.
Diffstat (limited to 'server/tests/fixtures')
-rw-r--r--server/tests/fixtures/peertube-plugin-test-video-constants/main.js58
1 files changed, 28 insertions, 30 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-video-constants/main.js b/server/tests/fixtures/peertube-plugin-test-video-constants/main.js
index 3e650e0a1..f44704a44 100644
--- a/server/tests/fixtures/peertube-plugin-test-video-constants/main.js
+++ b/server/tests/fixtures/peertube-plugin-test-video-constants/main.js
@@ -1,46 +1,44 @@
1async function register ({ 1async function register ({
2 registerHook,
3 registerSetting,
4 settingsManager,
5 storageManager,
6 videoCategoryManager, 2 videoCategoryManager,
7 videoLicenceManager, 3 videoLicenceManager,
8 videoLanguageManager, 4 videoLanguageManager,
9 videoPrivacyManager, 5 videoPrivacyManager,
10 playlistPrivacyManager 6 playlistPrivacyManager,
7 getRouter
11}) { 8}) {
12 videoLanguageManager.addLanguage('al_bhed', 'Al Bhed') 9 videoLanguageManager.addConstant('al_bhed', 'Al Bhed')
13 videoLanguageManager.addLanguage('al_bhed2', 'Al Bhed 2') 10 videoLanguageManager.addConstant('al_bhed2', 'Al Bhed 2')
14 videoLanguageManager.addLanguage('al_bhed3', 'Al Bhed 3') 11 videoLanguageManager.addConstant('al_bhed3', 'Al Bhed 3')
15 videoLanguageManager.deleteLanguage('en') 12 videoLanguageManager.deleteConstant('en')
16 videoLanguageManager.deleteLanguage('fr') 13 videoLanguageManager.deleteConstant('fr')
17 videoLanguageManager.deleteLanguage('al_bhed3') 14 videoLanguageManager.deleteConstant('al_bhed3')
18 15
19 videoCategoryManager.addCategory(42, 'Best category') 16 videoCategoryManager.addConstant(42, 'Best category')
20 videoCategoryManager.addCategory(43, 'High best category') 17 videoCategoryManager.addConstant(43, 'High best category')
21 videoCategoryManager.deleteCategory(1) // Music 18 videoCategoryManager.deleteConstant(1) // Music
22 videoCategoryManager.deleteCategory(2) // Films 19 videoCategoryManager.deleteConstant(2) // Films
23 20
24 videoLicenceManager.addLicence(42, 'Best licence') 21 videoLicenceManager.addConstant(42, 'Best licence')
25 videoLicenceManager.addLicence(43, 'High best licence') 22 videoLicenceManager.addConstant(43, 'High best licence')
26 videoLicenceManager.deleteLicence(1) // Attribution 23 videoLicenceManager.deleteConstant(1) // Attribution
27 videoLicenceManager.deleteLicence(7) // Public domain 24 videoLicenceManager.deleteConstant(7) // Public domain
28 25
29 videoPrivacyManager.deletePrivacy(2) 26 videoPrivacyManager.deleteConstant(2)
30 playlistPrivacyManager.deletePlaylistPrivacy(3) 27 playlistPrivacyManager.deleteConstant(3)
31} 28
29 {
30 const router = getRouter()
31 router.get('/reset-categories', (req, res) => {
32 videoCategoryManager.resetConstants()
32 33
33async function unregister () { 34 res.sendStatus(204)
34 return 35 })
36 }
35} 37}
36 38
39async function unregister () {}
40
37module.exports = { 41module.exports = {
38 register, 42 register,
39 unregister 43 unregister
40} 44}
41
42// ############################################################################
43
44function addToCount (obj) {
45 return Object.assign({}, obj, { count: obj.count + 1 })
46}