mirror of
https://github.com/docmost/docmost.git
synced 2026-05-15 21:24:09 +08:00
clean up
This commit is contained in:
@@ -14,7 +14,6 @@ import {
|
||||
import { CommentNotificationService } from './services/comment.notification';
|
||||
import { PageNotificationService } from './services/page.notification';
|
||||
import { DomainService } from '../../integrations/environment/domain.service';
|
||||
import { NotificationType } from './notification.constants';
|
||||
|
||||
@Processor(QueueName.NOTIFICATION_QUEUE)
|
||||
export class NotificationProcessor
|
||||
@@ -79,7 +78,7 @@ export class NotificationProcessor
|
||||
break;
|
||||
}
|
||||
|
||||
case NotificationType.PAGE_UPDATED: {
|
||||
case QueueJob.PAGE_UPDATED: {
|
||||
await this.pageNotificationService.processPageUpdate(
|
||||
job.data as IPageUpdateNotificationJob,
|
||||
appUrl,
|
||||
|
||||
@@ -24,10 +24,9 @@ export class PageUpdateEmailRateLimiter {
|
||||
|
||||
async addToDigest(userId: string, notificationId: string): Promise<boolean> {
|
||||
const key = DIGEST_PREFIX + userId;
|
||||
const isNew = (await this.redis.llen(key)) === 0;
|
||||
await this.redis.rpush(key, notificationId);
|
||||
const len = await this.redis.rpush(key, notificationId);
|
||||
await this.redis.expire(key, TTL_SECONDS);
|
||||
return isNew;
|
||||
return len === 1;
|
||||
}
|
||||
|
||||
async popDigest(userId: string): Promise<string[]> {
|
||||
|
||||
@@ -392,7 +392,7 @@ export class PageNotificationService {
|
||||
await this.notificationService.queueEmail(
|
||||
userId,
|
||||
notificationIds[0],
|
||||
`Your digest: ${pageUpdates.length} page updates`,
|
||||
`Your digest: ${pageUpdates.length} page ${pageUpdates.length === 1 ? 'update' : 'updates'}`,
|
||||
PageUpdateDigestEmail({
|
||||
userName: user.name,
|
||||
pageUpdates,
|
||||
|
||||
Reference in New Issue
Block a user