summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/SystemWebhookService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-10-09 15:17:22 +0100
committerdakkar <dakkar@thenautilus.net>2024-10-09 15:17:22 +0100
commitf00576bce6b5f4086112f48046316bfe49559759 (patch)
tree9268031a42551f3bfafbb33091f925e0cb5af3aa /packages/backend/src/core/SystemWebhookService.ts
parentMerge branch 'merge-requests/668' into feature/2024.9.0 (diff)
parentMerge pull request #14580 from misskey-dev/develop (diff)
downloadsharkey-f00576bce6b5f4086112f48046316bfe49559759.tar.gz
sharkey-f00576bce6b5f4086112f48046316bfe49559759.tar.bz2
sharkey-f00576bce6b5f4086112f48046316bfe49559759.zip
Merge remote-tracking branch 'misskey/master' into feature/2024.9.0
Diffstat (limited to 'packages/backend/src/core/SystemWebhookService.ts')
-rw-r--r--packages/backend/src/core/SystemWebhookService.ts13
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;
}