diff options
Diffstat (limited to 'shared/server-commands')
-rw-r--r-- | shared/server-commands/users/registrations-command.ts | 20 |
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 @@ | |||
1 | import { pick } from '@shared/core-utils' | 1 | import { pick } from '@shared/core-utils' |
2 | import { HttpStatusCode, ResultList, UserRegistration, UserRegistrationRequest } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, UserRegistration, UserRegistrationRequest, UserRegistrationUpdateState } from '@shared/models' |
3 | import { unwrapBody } from '../requests' | 3 | import { unwrapBody } from '../requests' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { 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 | }) |