Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] Add descriptions on user data download buttons and popup info #14852

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/models/server/models/ExportOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 4 additions & 2 deletions app/ui-account/client/accountPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -3109,8 +3109,8 @@
"UserDataDownload_EmailBody": "Your data file is now ready to download. Click <a href=\"__download_link__\">here</a> 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 <strong>__pending_operations__</strong> 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 <strong>__pending_operations__</strong> 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.",
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions server/methods/requestDataDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -33,6 +35,7 @@ Meteor.methods({
requested: false,
exportOperation: lastOperation,
url: lastFile.url,
pendingOperationsBeforeMyRequest: pendingOperationsBeforeMyRequestCount,
};
}
}
Expand All @@ -41,6 +44,7 @@ Meteor.methods({
requested: false,
exportOperation: lastOperation,
url: null,
pendingOperationsBeforeMyRequest: pendingOperationsBeforeMyRequestCount,
};
}
}
Expand Down Expand Up @@ -81,6 +85,7 @@ Meteor.methods({
requested: true,
exportOperation,
url: null,
pendingOperationsBeforeMyRequest: pendingOperationsBeforeMyRequestCount,
};
},
});