diff options
| author | Julia <julia@insertdomain.name> | 2024-11-05 03:59:23 +0000 |
|---|---|---|
| committer | Julia <julia@insertdomain.name> | 2024-11-05 03:59:23 +0000 |
| commit | 680e3ac7a3084313ed4857ffca2c582c5b3c7348 (patch) | |
| tree | 5621986847b8390b7c4f8e2f63cc53b180982b67 /packages/backend/src/core/SystemWebhookService.ts | |
| parent | merge: Bump version (!635) (diff) | |
| parent | comment out sharkey-specific crowdin link (diff) | |
| download | sharkey-680e3ac7a3084313ed4857ffca2c582c5b3c7348.tar.gz sharkey-680e3ac7a3084313ed4857ffca2c582c5b3c7348.tar.bz2 sharkey-680e3ac7a3084313ed4857ffca2c582c5b3c7348.zip | |
merge: release 2024.9.1 (!733)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/733
Approved-by: Marie <github@yuugi.dev>
Approved-by: Julia <julia@insertdomain.name>
Diffstat (limited to 'packages/backend/src/core/SystemWebhookService.ts')
| -rw-r--r-- | packages/backend/src/core/SystemWebhookService.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/backend/src/core/SystemWebhookService.ts b/packages/backend/src/core/SystemWebhookService.ts index bc6851f788..bb7c6b8c0e 100644 --- a/packages/backend/src/core/SystemWebhookService.ts +++ b/packages/backend/src/core/SystemWebhookService.ts @@ -54,7 +54,7 @@ export class SystemWebhookService implements OnApplicationShutdown { * SystemWebhook の一覧を取得する. */ @bindThis - public async fetchSystemWebhooks(params?: { + public fetchSystemWebhooks(params?: { ids?: MiSystemWebhook['id'][]; isActive?: MiSystemWebhook['isActive']; on?: MiSystemWebhook['on']; @@ -165,19 +165,24 @@ export class SystemWebhookService implements OnApplicationShutdown { /** * SystemWebhook をWebhook配送キューに追加する * @see QueueService.systemWebhookDeliver + * // TODO: contentの型を厳格化する */ @bindThis - public async enqueueSystemWebhook(webhook: MiSystemWebhook | MiSystemWebhook['id'], type: SystemWebhookEventType, content: unknown) { + public async enqueueSystemWebhook<T extends SystemWebhookEventType>( + webhook: MiSystemWebhook | MiSystemWebhook['id'], + type: T, + content: unknown, + ) { const webhookEntity = typeof webhook === 'string' ? (await this.fetchActiveSystemWebhooks()).find(a => a.id === webhook) : webhook; if (!webhookEntity || !webhookEntity.isActive) { - this.logger.info(`Webhook is not active or not found : ${webhook}`); + this.logger.info(`SystemWebhook is not active or not found : ${webhook}`); return; } if (!webhookEntity.on.includes(type)) { - this.logger.info(`Webhook ${webhookEntity.id} is not listening to ${type}`); + this.logger.info(`SystemWebhook ${webhookEntity.id} is not listening to ${type}`); return; } |