aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-20 15:34:01 +0100
committerChocobozzz <me@florianbigard.com>2023-01-20 15:34:01 +0100
commit4115f20084f302f497be9cb12237564679ca54ec (patch)
tree74cf8f5b3884edeb0b47b529cf04b306cd12b23d /shared/server-commands
parente854d57bed56bcbba4d191af54125ae6dd569a88 (diff)
downloadPeerTube-4115f20084f302f497be9cb12237564679ca54ec.tar.gz
PeerTube-4115f20084f302f497be9cb12237564679ca54ec.tar.zst
PeerTube-4115f20084f302f497be9cb12237564679ca54ec.zip
Add ability to not send an email for registration
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/users/registrations-command.ts20
1 files changed, 7 insertions, 13 deletions
diff --git a/shared/server-commands/users/registrations-command.ts b/shared/server-commands/users/registrations-command.ts
index 4e97571f4..f57f54b34 100644
--- a/shared/server-commands/users/registrations-command.ts
+++ b/shared/server-commands/users/registrations-command.ts
@@ -1,5 +1,5 @@
1import { pick } from '@shared/core-utils' 1import { pick } from '@shared/core-utils'
2import { HttpStatusCode, ResultList, UserRegistration, UserRegistrationRequest } from '@shared/models' 2import { HttpStatusCode, ResultList, UserRegistration, UserRegistrationRequest, UserRegistrationUpdateState } from '@shared/models'
3import { unwrapBody } from '../requests' 3import { unwrapBody } from '../requests'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 5
@@ -47,35 +47,29 @@ export class RegistrationsCommand extends AbstractCommand {
47 47
48 // --------------------------------------------------------------------------- 48 // ---------------------------------------------------------------------------
49 49
50 accept (options: OverrideCommandOptions & { 50 accept (options: OverrideCommandOptions & { id: number } & UserRegistrationUpdateState) {
51 id: number 51 const { id } = options
52 moderationResponse: string
53 }) {
54 const { id, moderationResponse } = options
55 const path = '/api/v1/users/registrations/' + id + '/accept' 52 const path = '/api/v1/users/registrations/' + id + '/accept'
56 53
57 return this.postBodyRequest({ 54 return this.postBodyRequest({
58 ...options, 55 ...options,
59 56
60 path, 57 path,
61 fields: { moderationResponse }, 58 fields: pick(options, [ 'moderationResponse', 'preventEmailDelivery' ]),
62 implicitToken: true, 59 implicitToken: true,
63 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 60 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
64 }) 61 })
65 } 62 }
66 63
67 reject (options: OverrideCommandOptions & { 64 reject (options: OverrideCommandOptions & { id: number } & UserRegistrationUpdateState) {
68 id: number 65 const { id } = options
69 moderationResponse: string
70 }) {
71 const { id, moderationResponse } = options
72 const path = '/api/v1/users/registrations/' + id + '/reject' 66 const path = '/api/v1/users/registrations/' + id + '/reject'
73 67
74 return this.postBodyRequest({ 68 return this.postBodyRequest({
75 ...options, 69 ...options,
76 70
77 path, 71 path,
78 fields: { moderationResponse }, 72 fields: pick(options, [ 'moderationResponse', 'preventEmailDelivery' ]),
79 implicitToken: true, 73 implicitToken: true,
80 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 74 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
81 }) 75 })