mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-30 03:09:53 +01:00
closes #198
This commit is contained in:
@@ -101,9 +101,12 @@ var user = require('./../user.js'),
|
||||
res.json(data);
|
||||
});
|
||||
|
||||
app.get('/api/topic/:id/:slug?', function(req, res) {
|
||||
app.get('/api/topic/:id/:slug?', function(req, res, next) {
|
||||
var uid = (req.user) ? req.user.uid : 0;
|
||||
topics.getTopicWithPosts(req.params.id, uid, function(err, data) {
|
||||
if(data.deleted === '1' && data.expose_tools === 0) {
|
||||
return res.json(404, {});
|
||||
}
|
||||
res.json(data);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -207,6 +207,7 @@ var express = require('express'),
|
||||
|
||||
|
||||
app.get('/topic/:topic_id/:slug?', function(req, res) {
|
||||
|
||||
var tid = req.params.topic_id;
|
||||
if (tid.match(/^\d+\.rss$/)) {
|
||||
fs.readFile('feeds/topics/' + tid, function (err, data) {
|
||||
@@ -221,13 +222,19 @@ var express = require('express'),
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
topics.getTopicField(tid, 'deleted', function(err, deleted) {
|
||||
if(deleted === '1')
|
||||
return next(1, null);
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
topics.getTopicWithPosts(tid, ((req.user) ? req.user.uid : 0), function(err, topicData) {
|
||||
next(err, topicData);
|
||||
});
|
||||
},
|
||||
function(topicData, next) {
|
||||
var posts = topicData.posts.push(topicData.main_posts[0]),
|
||||
var posts = topicData.posts.push(topicData.main_posts[0]),
|
||||
lastMod = 0,
|
||||
timestamp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user