mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 08:31:22 +01:00
Merge branch 'master' of https://github.com/NodeBB/NodeBB
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# The base image is the latest 8.x node (LTS)
|
||||
FROM node:8.13.0@sha256:3ecf259bf23f8a75555cf0b92ac5ad3c746e7e2262e937a9bed9ca1685f8e1c7
|
||||
FROM node:8.14.0@sha256:773480516f79e0948b02d7a06971b07bf76b08d706cf88a358b5b69dd4c83db0
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
@@ -111,11 +111,11 @@
|
||||
"serve-favicon": "^2.4.5",
|
||||
"sharp": "0.21.0",
|
||||
"sitemap": "^2.0.0",
|
||||
"socket.io": "2.1.1",
|
||||
"socket.io": "2.2.0",
|
||||
"socket.io-adapter-cluster": "^1.0.1",
|
||||
"socket.io-adapter-mongo": "^2.0.1",
|
||||
"socket.io-adapter-postgres": "^1.0.1",
|
||||
"socket.io-client": "2.1.1",
|
||||
"socket.io-client": "2.2.0",
|
||||
"socket.io-redis": "5.2.0",
|
||||
"socketio-wildcard": "2.0.0",
|
||||
"spdx-license-list": "^5.0.0",
|
||||
|
||||
@@ -85,7 +85,7 @@ module.exports = function (Categories) {
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
const categoriesToLoad = categoryData.filter(category => parseInt(category.numRecentReplies, 10) > 0);
|
||||
const categoriesToLoad = categoryData.filter(category => category && category.numRecentReplies && parseInt(category.numRecentReplies, 10) > 0);
|
||||
const keys = categoriesToLoad.map(category => 'cid:' + category.cid + ':recent_tids');
|
||||
db.getSortedSetsMembers(keys, next);
|
||||
},
|
||||
@@ -153,23 +153,27 @@ module.exports = function (Categories) {
|
||||
|
||||
function assignTopicsToCategories(categories, topics) {
|
||||
categories.forEach(function (category) {
|
||||
category.posts = topics.filter(topic => topic.cid && (topic.cid === category.cid || topic.parentCid === category.cid))
|
||||
.sort((a, b) => b.pid - a.pid)
|
||||
.slice(0, parseInt(category.numRecentReplies, 10));
|
||||
if (category) {
|
||||
category.posts = topics.filter(topic => topic.cid && (topic.cid === category.cid || topic.parentCid === category.cid))
|
||||
.sort((a, b) => b.pid - a.pid)
|
||||
.slice(0, parseInt(category.numRecentReplies, 10));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bubbleUpChildrenPosts(categoryData) {
|
||||
categoryData.forEach(function (category) {
|
||||
if (category.posts.length) {
|
||||
return;
|
||||
}
|
||||
var posts = [];
|
||||
getPostsRecursive(category, posts);
|
||||
if (category) {
|
||||
if (category.posts.length) {
|
||||
return;
|
||||
}
|
||||
var posts = [];
|
||||
getPostsRecursive(category, posts);
|
||||
|
||||
posts.sort((a, b) => b.pid - a.pid);
|
||||
if (posts.length) {
|
||||
category.posts = [posts[0]];
|
||||
posts.sort((a, b) => b.pid - a.pid);
|
||||
if (posts.length) {
|
||||
category.posts = [posts[0]];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user