From 7a2f0ae15be10df323d4ceb1e84fe60b06fc416d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 21 Sep 2021 16:10:37 -0400 Subject: [PATCH] fix: show local time for ban --- public/src/sockets.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/public/src/sockets.js b/public/src/sockets.js index 24fe64e747..b3bc6795ee 100644 --- a/public/src/sockets.js +++ b/public/src/sockets.js @@ -212,15 +212,20 @@ socket = window.socket; } function onEventBanned(data) { - var message = data.until ? '[[error:user-banned-reason-until, ' + utils.toISOString(data.until) + ', ' + data.reason + ']]' : '[[error:user-banned-reason, ' + data.reason + ']]'; - - bootbox.alert({ - title: '[[error:user-banned]]', - message: message, - closeButton: false, - callback: function () { - window.location.href = config.relative_path + '/'; - }, + require(['translator'], function (translator) { + var message = data.until ? + translator.compile('error:user-banned-reason-until', (new Date(data.until).toLocaleString()), data.reason) : + '[[error:user-banned-reason, ' + data.reason + ']]'; + translator.translate(message, function (message) { + bootbox.alert({ + title: '[[error:user-banned]]', + message: message, + closeButton: false, + callback: function () { + window.location.href = config.relative_path + '/'; + }, + }); + }); }); }