v1.18.x
Baris Soner Usakli 12 years ago
parent 545069b069
commit eff1b174c0

@ -101,9 +101,12 @@ var user = require('./../user.js'),
res.json(data); 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; var uid = (req.user) ? req.user.uid : 0;
topics.getTopicWithPosts(req.params.id, uid, function(err, data) { topics.getTopicWithPosts(req.params.id, uid, function(err, data) {
if(data.deleted === '1' && data.expose_tools === 0) {
return res.json(404, {});
}
res.json(data); res.json(data);
}); });
}); });

@ -207,6 +207,7 @@ var express = require('express'),
app.get('/topic/:topic_id/:slug?', function(req, res) { app.get('/topic/:topic_id/:slug?', function(req, res) {
var tid = req.params.topic_id; var tid = req.params.topic_id;
if (tid.match(/^\d+\.rss$/)) { if (tid.match(/^\d+\.rss$/)) {
fs.readFile('feeds/topics/' + tid, function (err, data) { fs.readFile('feeds/topics/' + tid, function (err, data) {
@ -221,13 +222,19 @@ var express = require('express'),
} }
async.waterfall([ async.waterfall([
function(next) {
topics.getTopicField(tid, 'deleted', function(err, deleted) {
if(deleted === '1')
return next(1, null);
});
},
function(next) { function(next) {
topics.getTopicWithPosts(tid, ((req.user) ? req.user.uid : 0), function(err, topicData) { topics.getTopicWithPosts(tid, ((req.user) ? req.user.uid : 0), function(err, topicData) {
next(err, topicData); next(err, topicData);
}); });
}, },
function(topicData, next) { function(topicData, next) {
var posts = topicData.posts.push(topicData.main_posts[0]), var posts = topicData.posts.push(topicData.main_posts[0]),
lastMod = 0, lastMod = 0,
timestamp; timestamp;

Loading…
Cancel
Save