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

Revert "Translator service integration" #15

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ coverage
test/files/normalise.jpg.png
test/files/normalise-resized.jpg
package-lock.json
/package.json
*.mongodb
link-plugins.sh
test.sh
Expand Down
Binary file removed dump.rdb
Binary file not shown.
199 changes: 0 additions & 199 deletions package.json

This file was deleted.

54 changes: 17 additions & 37 deletions public/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,35 @@ app.onDomReady();
(function () {
let logoutTimer = 0;
let logoutMessage;

// Separate the translation logic into a function that returns a promise
function translateMessage(callback) {
require(['translator'], function (translator) {
translator.translate('[[login:logged-out-due-to-inactivity]]', callback);
});
}
// Separate function to generate the logout message
function getLogoutMessage() {
return new Promise((resolve) => {
if (logoutMessage) {
resolve(logoutMessage);
} else {
translateMessage((translated) => {
function startLogoutTimer() {
if (app.config.adminReloginDuration <= 0) {
return;
}
if (logoutTimer) {
clearTimeout(logoutTimer);
}
// pre-translate language string gh#9046
if (!logoutMessage) {
require(['translator'], function (translator) {
translator.translate('[[login:logged-out-due-to-inactivity]]', function (translated) {
logoutMessage = translated;
resolve(logoutMessage);
});
}
});
}
// Separate the bootbox logic into its own function
function showLogoutAlert() {
getLogoutMessage().then((message) => {
});
}

logoutTimer = setTimeout(function () {
require(['bootbox'], function (bootbox) {
bootbox.alert({
closeButton: false,
message: message,
message: logoutMessage,
callback: function () {
window.location.reload();
},
});
});
});
}

// Logout timer start logic
function startLogoutTimer() {
if (app.config.adminReloginDuration <= 0) {
return;
}

if (logoutTimer) {
clearTimeout(logoutTimer);
}

logoutTimer = setTimeout(() => {
showLogoutAlert();
}, 3600000);
}

require(['hooks', 'admin/settings'], (hooks, Settings) => {
hooks.on('action:ajaxify.end', (data) => {
updatePageTitle(data.url);
Expand Down