I'm getting all available categories for a user with categories.getCategoriesByPrivilege
. Then I append to it with
categories.getRecentTopicReplies
. I'm not getting what I want, only the top post (reply).
What I want is the following; a list of all topics with recent posts (preferably with a max limit in time range), within my available categories. What the client I'm working for want is a feed type thing with all recent activity displayed in one single flow. Then I will also drill down into specific categories but I think I've got that covered.
This is where I'm at so far:
Controllers.renderFeedPage = function (req, res) {
if (!req.uid) {
res.render('feed', {});
}
let categoriesData;
let tree;
async.waterfall([
(next) => {
categories.getCategoriesByPrivilege('categories:cid', req.uid, 'find', next);
},
(_categoriesData, next) => {
categoriesData = _categoriesData;
tree = categories.getTree(categoriesData, 0);
categories.getRecentTopicReplies(categoriesData, req.uid, next);
},
() => {
const data = {
title: meta.config.homePageTitle || '[[pages:home]]',
categories: tree,
};
res.render('feed', data);
},
]);
};
I haven't found a good example from the forum and I'm reading source code at this point.
If anyone has done something similar I would really appreciate the input and a nudge in the right direction.
Thanks!