From 1f256e7d3cf056c2d999260155cdba58ae1b878b Mon Sep 17 00:00:00 2001 From: Poslovitch Date: Sat, 24 Apr 2021 09:57:01 +0000 Subject: Implemented configurable minimum signup age Implements https://github.com/Chocobozzz/PeerTube/issues/3612 Fixed lint and removed debug Fixed another lint error Apply suggestions from code review Co-authored-by: Chocobozzz Add tests for min signup age config --- server/tests/api/check-params/config.ts | 3 ++- server/tests/api/server/config.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 004aa65b3..9549070ef 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -73,7 +73,8 @@ describe('Test config API validators', function () { signup: { enabled: false, limit: 5, - requiresEmailVerification: false + requiresEmailVerification: false, + minimumAge: 16 }, admin: { email: 'superadmin1@example.com' diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 1d9ea31df..19bf9582c 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -60,6 +60,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) { expect(data.signup.enabled).to.be.true expect(data.signup.limit).to.equal(4) + expect(data.signup.minimumAge).to.equal(16) expect(data.signup.requiresEmailVerification).to.be.false expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com') @@ -151,6 +152,7 @@ function checkUpdatedConfig (data: CustomConfig) { expect(data.signup.enabled).to.be.false expect(data.signup.limit).to.equal(5) expect(data.signup.requiresEmailVerification).to.be.false + expect(data.signup.minimumAge).to.equal(10) // We override admin email in parallel tests, so skip this exception if (parallelTests() === false) { @@ -316,7 +318,8 @@ describe('Test config', function () { signup: { enabled: false, limit: 5, - requiresEmailVerification: false + requiresEmailVerification: false, + minimumAge: 10 }, admin: { email: 'superadmin1@example.com' -- cgit v1.2.3