summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NotificationService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/NotificationService.ts')
-rw-r--r--packages/backend/src/core/NotificationService.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/backend/src/core/NotificationService.ts b/packages/backend/src/core/NotificationService.ts
index 8bbc95b02d..9fef36dd2c 100644
--- a/packages/backend/src/core/NotificationService.ts
+++ b/packages/backend/src/core/NotificationService.ts
@@ -8,6 +8,7 @@ import type { Notification } from '@/models/entities/Notification.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { GlobalEventService } from './GlobalEventService.js';
import { PushNotificationService } from './PushNotificationService.js';
+import { bindThis } from '@/decorators.js';
@Injectable()
export class NotificationService {
@@ -21,6 +22,7 @@ export class NotificationService {
) {
}
+ @bindThis
public async readNotification(
userId: User['id'],
notificationIds: Notification['id'][],
@@ -42,6 +44,7 @@ export class NotificationService {
else return this.postReadNotifications(userId, notificationIds);
}
+ @bindThis
public async readNotificationByQuery(
userId: User['id'],
query: Record<string, any>,
@@ -55,11 +58,13 @@ export class NotificationService {
return this.readNotification(userId, notificationIds);
}
+ @bindThis
private postReadAllNotifications(userId: User['id']) {
this.globalEventService.publishMainStream(userId, 'readAllNotifications');
return this.pushNotificationService.pushNotification(userId, 'readAllNotifications', undefined);
}
+ @bindThis
private postReadNotifications(userId: User['id'], notificationIds: Notification['id'][]) {
this.globalEventService.publishMainStream(userId, 'readNotifications', notificationIds);
return this.pushNotificationService.pushNotification(userId, 'readNotifications', { notificationIds });