mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
use full word
This commit is contained in:
@@ -113,33 +113,37 @@ export class VerificationNotificationService {
|
|||||||
data: IVerificationExpiredNotificationJob,
|
data: IVerificationExpiredNotificationJob,
|
||||||
appUrl: string,
|
appUrl: string,
|
||||||
) {
|
) {
|
||||||
const v = await this.db
|
const verification = await this.db
|
||||||
.selectFrom('pageVerifications')
|
.selectFrom('pageVerifications')
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.where('id', '=', data.verificationId)
|
.where('id', '=', data.verificationId)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
if (!v) return;
|
if (!verification) return;
|
||||||
if (v.type !== 'expiring') return;
|
if (verification.type !== 'expiring') return;
|
||||||
if (!v.expiresAt) return;
|
if (!verification.expiresAt) return;
|
||||||
if (new Date(v.expiresAt).getTime() > Date.now()) return;
|
if (new Date(verification.expiresAt).getTime() > Date.now()) return;
|
||||||
|
|
||||||
const verifierRows = await this.db
|
const verifierRows = await this.db
|
||||||
.selectFrom('pageVerifiers')
|
.selectFrom('pageVerifiers')
|
||||||
.select('userId')
|
.select('userId')
|
||||||
.where('pageVerificationId', '=', v.id)
|
.where('pageVerificationId', '=', verification.id)
|
||||||
.execute();
|
.execute();
|
||||||
const verifierIds = verifierRows.map((r) => r.userId);
|
const verifierIds = verifierRows.map((r) => r.userId);
|
||||||
if (verifierIds.length === 0) return;
|
if (verifierIds.length === 0) return;
|
||||||
|
|
||||||
const accessibleVerifierIds = await this.filterAccessibleRecipients(
|
const accessibleVerifierIds = await this.filterAccessibleRecipients(
|
||||||
verifierIds,
|
verifierIds,
|
||||||
v.pageId,
|
verification.pageId,
|
||||||
v.spaceId,
|
verification.spaceId,
|
||||||
);
|
);
|
||||||
if (accessibleVerifierIds.length === 0) return;
|
if (accessibleVerifierIds.length === 0) return;
|
||||||
|
|
||||||
const context = await this.getPageContext(v.pageId, v.spaceId, appUrl);
|
const context = await this.getPageContext(
|
||||||
|
verification.pageId,
|
||||||
|
verification.spaceId,
|
||||||
|
appUrl,
|
||||||
|
);
|
||||||
if (!context) return;
|
if (!context) return;
|
||||||
|
|
||||||
const { pageTitle, basePageUrl } = context;
|
const { pageTitle, basePageUrl } = context;
|
||||||
@@ -147,10 +151,10 @@ export class VerificationNotificationService {
|
|||||||
for (const userId of accessibleVerifierIds) {
|
for (const userId of accessibleVerifierIds) {
|
||||||
const notification = await this.notificationService.create({
|
const notification = await this.notificationService.create({
|
||||||
userId,
|
userId,
|
||||||
workspaceId: v.workspaceId,
|
workspaceId: verification.workspaceId,
|
||||||
type: NotificationType.PAGE_VERIFICATION_EXPIRED,
|
type: NotificationType.PAGE_VERIFICATION_EXPIRED,
|
||||||
pageId: v.pageId,
|
pageId: verification.pageId,
|
||||||
spaceId: v.spaceId,
|
spaceId: verification.spaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const subject = `"${pageTitle}" verification has expired`;
|
const subject = `"${pageTitle}" verification has expired`;
|
||||||
|
|||||||
Reference in New Issue
Block a user