This commit is contained in:
syuilo 2022-09-19 03:11:50 +09:00
parent 92c78218bc
commit a2eac9fff6
82 changed files with 671 additions and 671 deletions

View file

@ -38,8 +38,8 @@ export class NotificationService {
if (result.affected === 0) return;
if (!await this.userEntityService.getHasUnreadNotification(userId)) return this.#postReadAllNotifications(userId);
else return this.#postReadNotifications(userId, notificationIds);
if (!await this.userEntityService.getHasUnreadNotification(userId)) return this.postReadAllNotifications(userId);
else return this.postReadNotifications(userId, notificationIds);
}
public async readNotificationByQuery(
@ -55,12 +55,12 @@ export class NotificationService {
return this.readNotification(userId, notificationIds);
}
#postReadAllNotifications(userId: User['id']) {
private postReadAllNotifications(userId: User['id']) {
this.globalEventService.publishMainStream(userId, 'readAllNotifications');
return this.pushNotificationService.pushNotification(userId, 'readAllNotifications', undefined);
}
#postReadNotifications(userId: User['id'], notificationIds: Notification['id'][]) {
private postReadNotifications(userId: User['id'], notificationIds: Notification['id'][]) {
this.globalEventService.publishMainStream(userId, 'readNotifications', notificationIds);
return this.pushNotificationService.pushNotification(userId, 'readNotifications', { notificationIds });
}