summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/WebhookService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-09-19 03:11:50 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-09-19 03:11:50 +0900
commita2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8 (patch)
tree9c7190e05fe0ffe085646cd194c6c65d47375f83 /packages/backend/src/core/WebhookService.ts
parentrevert (diff)
downloadsharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.tar.gz
sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.tar.bz2
sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.zip
test
Diffstat (limited to 'packages/backend/src/core/WebhookService.ts')
-rw-r--r--packages/backend/src/core/WebhookService.ts24
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/backend/src/core/WebhookService.ts b/packages/backend/src/core/WebhookService.ts
index 3ed615ca0b..1d74290dd9 100644
--- a/packages/backend/src/core/WebhookService.ts
+++ b/packages/backend/src/core/WebhookService.ts
@@ -7,8 +7,8 @@ import type { OnApplicationShutdown } from '@nestjs/common';
@Injectable()
export class WebhookService implements OnApplicationShutdown {
- #webhooksFetched = false;
- #webhooks: Webhook[] = [];
+ private webhooksFetched = false;
+ private webhooks: Webhook[] = [];
constructor(
@Inject(DI.redisSubscriber)
@@ -22,14 +22,14 @@ export class WebhookService implements OnApplicationShutdown {
}
public async getActiveWebhooks() {
- if (!this.#webhooksFetched) {
- this.#webhooks = await this.webhooksRepository.findBy({
+ if (!this.webhooksFetched) {
+ this.webhooks = await this.webhooksRepository.findBy({
active: true,
});
- this.#webhooksFetched = true;
+ this.webhooksFetched = true;
}
- return this.#webhooks;
+ return this.webhooks;
}
private async onMessage(_, data) {
@@ -40,23 +40,23 @@ export class WebhookService implements OnApplicationShutdown {
switch (type) {
case 'webhookCreated':
if (body.active) {
- this.#webhooks.push(body);
+ this.webhooks.push(body);
}
break;
case 'webhookUpdated':
if (body.active) {
- const i = this.#webhooks.findIndex(a => a.id === body.id);
+ const i = this.webhooks.findIndex(a => a.id === body.id);
if (i > -1) {
- this.#webhooks[i] = body;
+ this.webhooks[i] = body;
} else {
- this.#webhooks.push(body);
+ this.webhooks.push(body);
}
} else {
- this.#webhooks = this.#webhooks.filter(a => a.id !== body.id);
+ this.webhooks = this.webhooks.filter(a => a.id !== body.id);
}
break;
case 'webhookDeleted':
- this.#webhooks = this.#webhooks.filter(a => a.id !== body.id);
+ this.webhooks = this.webhooks.filter(a => a.id !== body.id);
break;
default:
break;