From 8ae03c37181822617418d1fc372982b245ac0a9a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 3 Sep 2019 09:49:04 +0200 Subject: Add creation reason --- server/controllers/api/config.ts | 2 ++ server/initializers/config.ts | 2 ++ server/tests/api/check-params/config.ts | 1 + server/tests/api/server/config.ts | 3 +++ 4 files changed, 8 insertions(+) (limited to 'server') diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index b5244756d..909907ad6 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -161,6 +161,7 @@ function getAbout (req: express.Request, res: express.Response) { terms: CONFIG.INSTANCE.TERMS, codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, + creationReason: CONFIG.INSTANCE.CREATION_REASON, moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, administrator: CONFIG.INSTANCE.ADMINISTRATOR, maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, @@ -232,6 +233,7 @@ function customConfig (): CustomConfig { terms: CONFIG.INSTANCE.TERMS, codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, + creationReason: CONFIG.INSTANCE.CREATION_REASON, moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, administrator: CONFIG.INSTANCE.ADMINISTRATOR, maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 4e2b07e64..8df411ca5 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -211,6 +211,8 @@ const CONFIG = { get TERMS () { return config.get('instance.terms') }, get CODE_OF_CONDUCT () { return config.get('instance.code_of_conduct') }, + get CREATION_REASON () { return config.get('instance.creation_reason') }, + get MODERATION_INFORMATION () { return config.get('instance.moderation_information') }, get ADMINISTRATOR () { return config.get('instance.administrator') }, get MAINTENANCE_LIFETIME () { return config.get('instance.maintenance_lifetime') }, diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index f716dc673..9b902a1cd 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -29,6 +29,7 @@ describe('Test config API validators', function () { terms: 'my super terms', codeOfConduct: 'my super coc', + creationReason: 'my super reason', moderationInformation: 'my super moderation information', administrator: 'Kuja', maintenanceLifetime: 'forever', diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index da75495a5..85d0f9702 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -30,6 +30,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) { expect(data.instance.description).to.equal('Welcome to this PeerTube instance!') expect(data.instance.terms).to.equal('No terms for now.') + expect(data.instance.creationReason).to.be.empty expect(data.instance.codeOfConduct).to.be.empty expect(data.instance.moderationInformation).to.be.empty expect(data.instance.administrator).to.be.empty @@ -90,6 +91,7 @@ function checkUpdatedConfig (data: CustomConfig) { expect(data.instance.description).to.equal('my super description') expect(data.instance.terms).to.equal('my super terms') + expect(data.instance.creationReason).to.equal('my super creation reason') expect(data.instance.codeOfConduct).to.equal('my super coc') expect(data.instance.moderationInformation).to.equal('my super moderation information') expect(data.instance.administrator).to.equal('Kuja') @@ -212,6 +214,7 @@ describe('Test config', function () { terms: 'my super terms', codeOfConduct: 'my super coc', + creationReason: 'my super creation reason', moderationInformation: 'my super moderation information', administrator: 'Kuja', maintenanceLifetime: 'forever', -- cgit v1.2.3