Compare commits

...

4 Commits

Author SHA1 Message Date
renovate[bot]
ab5035f4e2 fix(deps): update dependency nodebb-plugin-dbsearch to v3.0.3 (#7035) 2018-11-30 12:54:13 -05:00
Baris Usakli
2555d72c84 change deprecated message 2018-11-30 12:53:21 -05:00
Barış Soner Uşaklı
213582df8b dont crash for undefined categories 2018-11-29 10:41:37 -05:00
Misty (Bot)
543336070a Incremented version number - v1.11.0 2018-11-28 21:53:14 +00:00
3 changed files with 10 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
"name": "nodebb", "name": "nodebb",
"license": "GPL-3.0", "license": "GPL-3.0",
"description": "NodeBB Forum", "description": "NodeBB Forum",
"version": "1.10.2", "version": "1.11.0",
"homepage": "http://www.nodebb.org", "homepage": "http://www.nodebb.org",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -80,7 +80,7 @@
"mubsub-nbb": "^1.5.0", "mubsub-nbb": "^1.5.0",
"nconf": "^0.10.0", "nconf": "^0.10.0",
"nodebb-plugin-composer-default": "6.1.10", "nodebb-plugin-composer-default": "6.1.10",
"nodebb-plugin-dbsearch": "3.0.0", "nodebb-plugin-dbsearch": "3.0.3",
"nodebb-plugin-emoji": "^2.2.5", "nodebb-plugin-emoji": "^2.2.5",
"nodebb-plugin-emoji-android": "2.0.0", "nodebb-plugin-emoji-android": "2.0.0",
"nodebb-plugin-markdown": "8.8.5", "nodebb-plugin-markdown": "8.8.5",

View File

@@ -335,12 +335,14 @@ Categories.flattenCategories = function (allCategories, categoryData) {
*/ */
Categories.getTree = function (categories, parentCid) { Categories.getTree = function (categories, parentCid) {
parentCid = parentCid || 0; parentCid = parentCid || 0;
const cids = categories.map(category => category.cid); const cids = categories.map(category => category && category.cid);
const cidToCategory = {}; const cidToCategory = {};
const parents = {}; const parents = {};
cids.forEach((cid, index) => { cids.forEach((cid, index) => {
cidToCategory[cid] = categories[index]; if (cid) {
parents[cid] = _.clone(categories[index]); cidToCategory[cid] = categories[index];
parents[cid] = _.clone(categories[index]);
}
}); });
const tree = []; const tree = [];

View File

@@ -47,11 +47,11 @@ module.require = function (p) {
if (err.code === 'MODULE_NOT_FOUND') { if (err.code === 'MODULE_NOT_FOUND') {
let stackLine = err.stack.split('\n'); let stackLine = err.stack.split('\n');
stackLine = stackLine.find(line => line.includes('nodebb-plugin') || line.includes('nodebb-theme')); stackLine = stackLine.find(line => line.includes('nodebb-plugin') || line.includes('nodebb-theme'));
winston.warn('[plugins/require] ' + err.message + ', please update your plugin!\n' + stackLine); var deprecatedPath = err.message.replace('Cannot find module ', '');
winston.warn('[deprecated] requiring core modules with `module.parent.require(' + deprecatedPath + ')` is deprecated. Please use `require.main.require("./src/<module_name>")` instead.\n' + stackLine);
if (path.isAbsolute(p)) { if (path.isAbsolute(p)) {
throw err; throw err;
} }
return defaultRequire.apply(module, [path.join('../', p)]); return defaultRequire.apply(module, [path.join('../', p)]);
} }
throw err; throw err;