summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/SystemWebhookService.ts
diff options
context:
space:
mode:
authorおさむのひと <46447427+samunohito@users.noreply.github.com>2024-09-19 17:20:50 +0900
committerGitHub <noreply@github.com>2024-09-19 17:20:50 +0900
commit4ac8aad50a1a1ef2ac2a13a04baca445294397ed (patch)
tree37a81a7ca6a760dc0be88b61f409c4d24354d3ca /packages/backend/src/core/SystemWebhookService.ts
parentfix(frontend): viteの一時ファイルがgitの変更に含まれないよ... (diff)
downloadsharkey-4ac8aad50a1a1ef2ac2a13a04baca445294397ed.tar.gz
sharkey-4ac8aad50a1a1ef2ac2a13a04baca445294397ed.tar.bz2
sharkey-4ac8aad50a1a1ef2ac2a13a04baca445294397ed.zip
feat: UserWebhook/SystemWebhookのテスト送信機能を追加 (#14489)
* feat: UserWebhook/SystemWebhookのテスト送信機能を追加 * fix CHANGELOG.md * 一部設定をパラメータから上書き出来るように修正 * remove async * regenerate autogen
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;
}