mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
@@ -212,24 +212,6 @@ function generateForTopics(options, set, req, res, next) {
|
||||
}
|
||||
|
||||
function generateTopicsFeed(feedOptions, feedTopics, callback) {
|
||||
var tids = feedTopics.map(function(topic) {
|
||||
return topic ? topic.tid : null;
|
||||
});
|
||||
|
||||
topics.getMainPids(tids, function(err, pids) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
posts.getPostsFields(pids, ['content'], function(err, posts) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
feedTopics.forEach(function(topic, index) {
|
||||
if (topic && posts[index]) {
|
||||
topic.mainPost = posts[index].content;
|
||||
}
|
||||
});
|
||||
|
||||
feedOptions.ttl = 60;
|
||||
feedOptions.feed_url = nconf.get('url') + feedOptions.feed_url;
|
||||
@@ -242,17 +224,18 @@ function generateTopicsFeed(feedOptions, feedTopics, callback) {
|
||||
}
|
||||
|
||||
feedTopics.forEach(function(topicData) {
|
||||
if (topicData && topicData.teaser && topicData.teaser.user) {
|
||||
feed.item({
|
||||
title: topicData.title,
|
||||
description: topicData.mainPost,
|
||||
description: topicData.teaser.content,
|
||||
url: nconf.get('url') + '/topic/' + topicData.slug,
|
||||
author: topicData.username,
|
||||
author: topicData.teaser.user.username,
|
||||
date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString()
|
||||
});
|
||||
}
|
||||
});
|
||||
callback(null, feed);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function generateForRecentPosts(req, res, next) {
|
||||
|
||||
Reference in New Issue
Block a user