mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
Revert "feat: load timeago strings client-side"
This reverts commit 558a2d739c.
This commit is contained in:
@@ -15,6 +15,7 @@ var plugins = require('../plugins');
|
||||
var navigation = require('../navigation');
|
||||
var translator = require('../translator');
|
||||
var privileges = require('../privileges');
|
||||
var languages = require('../languages');
|
||||
var utils = require('../utils');
|
||||
var helpers = require('./helpers');
|
||||
|
||||
@@ -187,8 +188,25 @@ module.exports = function (middleware) {
|
||||
templateValues: templateValues,
|
||||
});
|
||||
|
||||
const scripts = await plugins.fireHook('filter:scripts.get', []);
|
||||
data.templateValues.scripts = scripts.map(function (script) {
|
||||
const results = await utils.promiseParallel({
|
||||
scripts: plugins.fireHook('filter:scripts.get', []),
|
||||
timeagoLocale: (async () => {
|
||||
const languageCodes = await languages.listCodes();
|
||||
const userLang = res.locals.config.userLang;
|
||||
const timeagoCode = utils.userLangToTimeagoCode(userLang);
|
||||
|
||||
if (languageCodes.includes(userLang) && languages.timeagoCodes.includes(timeagoCode)) {
|
||||
const pathToLocaleFile = '/vendor/jquery/timeago/locales/jquery.timeago.' + timeagoCode + '.js';
|
||||
return nconf.get('relative_path') + '/assets' + pathToLocaleFile;
|
||||
}
|
||||
return false;
|
||||
})(),
|
||||
});
|
||||
|
||||
if (results.timeagoLocale) {
|
||||
results.scripts.push(results.timeagoLocale);
|
||||
}
|
||||
data.templateValues.scripts = results.scripts.map(function (script) {
|
||||
return { src: script };
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user