diff --git a/app/models/server/models/ExportOperations.js b/app/models/server/models/ExportOperations.js
index a72fdc486e20..72c4be71ca1b 100644
--- a/app/models/server/models/ExportOperations.js
+++ b/app/models/server/models/ExportOperations.js
@@ -46,6 +46,15 @@ export class ExportOperations extends Base {
return this.find(query, options);
}
+ findAllPendingBeforeMyRequest(requestDay, options) {
+ const query = {
+ status: { $nin: ['completed'] },
+ createdAt: { $lt: requestDay },
+ };
+
+ return this.find(query, options);
+ }
+
// UPDATE
updateOperation(data) {
const update = {
diff --git a/app/ui-account/client/accountPreferences.js b/app/ui-account/client/accountPreferences.js
index 417092de21cb..cd4058b3664d 100644
--- a/app/ui-account/client/accountPreferences.js
+++ b/app/ui-account/client/accountPreferences.js
@@ -235,8 +235,9 @@ Template.accountPreferences.onCreated(function() {
if (results.requested) {
modal.open({
title: t('UserDataDownload_Requested'),
- text: t('UserDataDownload_Requested_Text'),
+ text: t('UserDataDownload_Requested_Text', { pending_operations: results.pendingOperationsBeforeMyRequest }),
type: 'success',
+ html: true,
});
return true;
@@ -260,8 +261,9 @@ Template.accountPreferences.onCreated(function() {
modal.open({
title: t('UserDataDownload_Requested'),
- text: t('UserDataDownload_RequestExisted_Text'),
+ text: t('UserDataDownload_RequestExisted_Text', { pending_operations: results.pendingOperationsBeforeMyRequest }),
type: 'success',
+ html: true,
});
return true;
}
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index 5fe15369f9d5..43b9d366c7ab 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -1102,7 +1102,7 @@
"Domains": "Domains",
"Domains_allowed_to_embed_the_livechat_widget": "Comma-separated list of domains allowed to embed the livechat widget. Leave blank to allow all domains.",
"Downloading_file_from_external_URL": "Downloading file from external URL",
- "Download_My_Data": "Download My Data",
+ "Download_My_Data": "Download My Data (HTML)",
"Download_Snippet": "Download",
"Drop_to_upload_file": "Drop to upload file",
"Dry_run": "Dry run",
@@ -1318,7 +1318,7 @@
"except_pinned": "(except those that are pinned)",
"Execute_Synchronization_Now": "Execute Synchronization Now",
"Exit_Full_Screen": "Exit Full Screen",
- "Export_My_Data": "Export My Data",
+ "Export_My_Data": "Export My Data (JSON)",
"expression": "Expression",
"Extended": "Extended",
"External_Domains": "External Domains",
@@ -3109,8 +3109,8 @@
"UserDataDownload_EmailBody": "Your data file is now ready to download. Click here to download it.",
"UserDataDownload_EmailSubject": "Your Data File is Ready to Download",
"UserDataDownload_Requested": "Download File Requested",
- "UserDataDownload_Requested_Text": "Your data file will be generated. A link to download it will be sent to your email address when ready.",
- "UserDataDownload_RequestExisted_Text": "Your data file is already being generated. A link to download it will be sent to your email address when ready.",
+ "UserDataDownload_Requested_Text": "Your data file will be generated. A link to download it will be sent to your email address when ready. There are __pending_operations__ queued operations to run before yours.",
+ "UserDataDownload_RequestExisted_Text": "Your data file is already being generated. A link to download it will be sent to your email address when ready. There are __pending_operations__ queued operations to run before yours.",
"Username": "Username",
"Username_already_exist": "Username already exists. Please try another username.",
"Username_and_message_must_not_be_empty": "Username and message must not be empty.",
diff --git a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
index ea5ec5fb0564..4c8164e5db32 100644
--- a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
@@ -1067,7 +1067,7 @@
"Domains": "Domínios",
"Domains_allowed_to_embed_the_livechat_widget": "A lista de domínios separados por vírgulas permitiu incorporar o widget do Livechat. Deixe em branco para permitir todos os domínios.",
"Downloading_file_from_external_URL": "Baixar arquivo de URL externa",
- "Download_My_Data": "Baixar meus dados",
+ "Download_My_Data": "Baixar meus dados (HTML)",
"Download_Snippet": "Baixar",
"Drop_to_upload_file": "Largue para enviar arquivos",
"Dry_run": "Simulação",
@@ -1279,7 +1279,7 @@
"except_pinned": "(exceto aqueles que estão presos)",
"Execute_Synchronization_Now": "Execute sincronização agora",
"Exit_Full_Screen": "Sair da tela cheia",
- "Export_My_Data": "Exportar meus dados",
+ "Export_My_Data": "Exportar meus dados (JSON)",
"expression": "Expressão",
"Extended": "Estendido",
"External_Domains": "Domínios Externos",
diff --git a/server/methods/requestDataDownload.js b/server/methods/requestDataDownload.js
index 255def67976a..d2eb9f20c5a8 100644
--- a/server/methods/requestDataDownload.js
+++ b/server/methods/requestDataDownload.js
@@ -20,6 +20,8 @@ Meteor.methods({
const userId = currentUserData._id;
const lastOperation = ExportOperations.findLastOperationByUser(userId, fullExport);
+ const requestDay = lastOperation ? lastOperation.createdAt : new Date();
+ const pendingOperationsBeforeMyRequestCount = ExportOperations.findAllPendingBeforeMyRequest(requestDay).count();
if (lastOperation) {
const yesterday = new Date();
@@ -33,6 +35,7 @@ Meteor.methods({
requested: false,
exportOperation: lastOperation,
url: lastFile.url,
+ pendingOperationsBeforeMyRequest: pendingOperationsBeforeMyRequestCount,
};
}
}
@@ -41,6 +44,7 @@ Meteor.methods({
requested: false,
exportOperation: lastOperation,
url: null,
+ pendingOperationsBeforeMyRequest: pendingOperationsBeforeMyRequestCount,
};
}
}
@@ -81,6 +85,7 @@ Meteor.methods({
requested: true,
exportOperation,
url: null,
+ pendingOperationsBeforeMyRequest: pendingOperationsBeforeMyRequestCount,
};
},
});