diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-10-18 21:14:49 +0000 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-10-18 21:14:49 +0000 |
| commit | ba17776b1961376b5369aa775e8910a227cc02ec (patch) | |
| tree | 0d0579dd911a6c9b74ebc84195cacf10eafe0918 /packages/backend/src/core/SystemWebhookService.ts | |
| parent | merge: Allow logged in users to refresh polls (!686) (diff) | |
| parent | Merge branch 'develop' into feature/2024.9.0 (diff) | |
| download | sharkey-ba17776b1961376b5369aa775e8910a227cc02ec.tar.gz sharkey-ba17776b1961376b5369aa775e8910a227cc02ec.tar.bz2 sharkey-ba17776b1961376b5369aa775e8910a227cc02ec.zip | |
merge: version 2024.9.0 (!675)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/675
Approved-by: Julia <julia@insertdomain.name>
Approved-by: Marie <github@yuugi.dev>
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; } |