mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 05:20:24 +01:00
Compare commits
5 Commits
ea1309e690
...
v1.16.2-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a76b5d15e0 | ||
|
|
a06b84d258 | ||
|
|
ecf212d307 | ||
|
|
dc6fc65322 | ||
|
|
27b481765b |
@@ -2,7 +2,7 @@
|
||||
"name": "nodebb",
|
||||
"license": "GPL-3.0",
|
||||
"description": "NodeBB Forum",
|
||||
"version": "1.16.2-beta.0",
|
||||
"version": "1.16.2-beta.2",
|
||||
"homepage": "http://www.nodebb.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -190,4 +190,4 @@
|
||||
"url": "https://github.com/barisusakli"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,19 @@
|
||||
|
||||
(function (factory) {
|
||||
function loadClient(language, namespace) {
|
||||
return Promise.resolve(jQuery.getJSON([config.assetBaseUrl, 'language', language, namespace].join('/') + '.json?' + config['cache-buster']));
|
||||
return new Promise(function (resolve, reject) {
|
||||
jQuery.getJSON([config.assetBaseUrl, 'language', language, namespace].join('/') + '.json?' + config['cache-buster'], function (data) {
|
||||
const payload = {
|
||||
language: language,
|
||||
namespace: namespace,
|
||||
data: data,
|
||||
};
|
||||
$(window).trigger('action:translator.loadClient', payload);
|
||||
resolve(payload.promise ? Promise.resolve(payload.promise) : data);
|
||||
}).fail(function (jqxhr, textStatus, error) {
|
||||
reject(new Error(textStatus + ', ' + error));
|
||||
});
|
||||
});
|
||||
}
|
||||
var warn = function () { console.warn.apply(console, arguments); };
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
@@ -545,6 +557,18 @@
|
||||
});
|
||||
},
|
||||
|
||||
flushNamespace: function (namespace) {
|
||||
Object.keys(Translator.cache).forEach(function (code) {
|
||||
if (Translator.cache[code] &&
|
||||
Translator.cache[code].translations &&
|
||||
Translator.cache[code].translations[namespace]
|
||||
) {
|
||||
Translator.cache[code].translations[namespace] = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Legacy translator function for backwards compatibility
|
||||
*/
|
||||
|
||||
@@ -57,9 +57,11 @@ Categories.getCategoryById = async function (data) {
|
||||
category.isIgnored = watchState[0] === Categories.watchStates.ignoring;
|
||||
category.parent = parent;
|
||||
|
||||
|
||||
calculateTopicPostCount(category);
|
||||
const result = await plugins.hooks.fire('filter:category.get', { category: category, uid: data.uid });
|
||||
const result = await plugins.hooks.fire('filter:category.get', {
|
||||
category: category,
|
||||
...data,
|
||||
});
|
||||
return result.category;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,11 +51,12 @@ notificationsController.get = async function (req, res, next) {
|
||||
if (!selectedFilter) {
|
||||
return next();
|
||||
}
|
||||
let nids = await user.notifications.getAll(req.uid, selectedFilter.filter);
|
||||
const pageCount = Math.max(1, Math.ceil(nids.length / itemsPerPage));
|
||||
nids = nids.slice(start, stop + 1);
|
||||
|
||||
const notifications = await user.notifications.getNotifications(nids, req.uid);
|
||||
const nids = await user.notifications.getAll(req.uid, selectedFilter.filter);
|
||||
let notifications = await user.notifications.getNotifications(nids, req.uid);
|
||||
|
||||
const pageCount = Math.max(1, Math.ceil(notifications.length / itemsPerPage));
|
||||
notifications = notifications.slice(start, stop + 1);
|
||||
|
||||
res.render('notifications', {
|
||||
notifications: notifications,
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const utils = require('./utils');
|
||||
const paths = require('./constants').paths;
|
||||
const { paths } = require('./constants');
|
||||
const plugins = require('./plugins');
|
||||
|
||||
const Languages = module.exports;
|
||||
const languagesPath = path.join(__dirname, '../build/public/language');
|
||||
@@ -12,8 +13,14 @@ const files = fs.readdirSync(path.join(paths.nodeModules, '/timeago/locales'));
|
||||
Languages.timeagoCodes = files.filter(f => f.startsWith('jquery.timeago')).map(f => f.split('.')[2]);
|
||||
|
||||
Languages.get = async function (language, namespace) {
|
||||
const data = await fs.promises.readFile(path.join(languagesPath, language, namespace + '.json'), 'utf8');
|
||||
return JSON.parse(data) || {};
|
||||
const data = await fs.promises.readFile(path.join(languagesPath, language, `${namespace}.json`), 'utf8');
|
||||
const parsed = JSON.parse(data) || {};
|
||||
const result = await plugins.hooks.fire('filter:languages.get', {
|
||||
language,
|
||||
namespace,
|
||||
data: parsed,
|
||||
});
|
||||
return result.data;
|
||||
};
|
||||
|
||||
let codeCache = null;
|
||||
|
||||
Reference in New Issue
Block a user