Add days until expiry to export email (#13175)

This commit is contained in:
Tom Moor
2026-07-27 21:43:35 -04:00
committed by GitHub
parent 023bda8c1b
commit f97523f0b0
4 changed files with 18 additions and 2 deletions
@@ -1,6 +1,7 @@
import * as React from "react";
import { NotificationEventType } from "@shared/types";
import env from "@server/env";
import { FileOperation } from "@server/models";
import NotificationSettingsHelper from "@server/models/helpers/NotificationSettingsHelper";
import type { EmailProps } from "./BaseEmail";
import BaseEmail, { EmailMessageCategory } from "./BaseEmail";
@@ -68,6 +69,8 @@ ${this.t("Your Data Export")}
${this.t("Your requested data export is complete, you can download from the link below in a browser that is logged into your account.")}
${this.t("This export will be available to download for {{ days }} days.", { days: FileOperation.expiryDays })}
${downloadLink}
`;
}
@@ -89,6 +92,12 @@ ${downloadLink}
"Your requested data export is complete - you can download from the link below in a browser that is logged into your account."
)}
</p>
<p>
{this.t(
"This export will be available to download for {{ days }} days.",
{ days: FileOperation.expiryDays }
)}
</p>
<EmptySpace height={10} />
<p>
<Button href={downloadLink}>{this.t("Download")}</Button>
+3
View File
@@ -109,6 +109,9 @@ class FileOperation extends ParanoidModel<
> {
static eventNamespace = "fileOperations";
/** The number of days a completed file operation remains downloadable. */
static expiryDays = 15;
/**
* Overrides the standard findByPk behavior to allow loading the exported
* collection or document with memberships for a user passed in by `userId`.
@@ -9,11 +9,14 @@ import { CronTask, TaskInterval } from "./base/CronTask";
export default class CleanupExpiredFileOperationsTask extends CronTask {
public async perform({ limit }: Props) {
Logger.info("task", `Expiring file operations older than 15 days…`);
Logger.info(
"task",
`Expiring file operations older than ${FileOperation.expiryDays} days…`
);
const fileOperations = await FileOperation.unscoped().findAll({
where: {
createdAt: {
[Op.lt]: subDays(new Date(), 15),
[Op.lt]: subDays(new Date(), FileOperation.expiryDays),
},
state: {
[Op.ne]: FileOperationState.Expired,
@@ -1747,6 +1747,7 @@
"Go to export": "Go to export",
"Here's your request data export from {{ appName }}": "Here's your request data export from {{ appName }}",
"Your requested data export is complete, you can download from the link below in a browser that is logged into your account.": "Your requested data export is complete, you can download from the link below in a browser that is logged into your account.",
"This export will be available to download for {{ days }} days.": "This export will be available to download for {{ days }} days.",
"Download export": "Download export",
"Your requested data export is complete - you can download from the link below in a browser that is logged into your account.": "Your requested data export is complete - you can download from the link below in a browser that is logged into your account.",
"The {{ groupName }} group was mentioned in “{{ documentTitle }}”": "The {{ groupName }} group was mentioned in “{{ documentTitle }}”",