Skip to content

Node.js based forum software built for the modern web

closes #199

Baris Soner Usakli545069b0695c
diff --git a/src/posts.js b/src/posts.js
index 6573ee433a..e34e06ee40 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -70,13 +70,18 @@ var RDB = require('./redis.js'),
}
Posts.addUserInfoToPost(postData, function() {
- topics.getTopicField(postData.tid, 'slug', function(err, topicSlug) {
+ topics.getTopicFields(postData.tid, ['slug', 'deleted'], function(err, topicData) {
+ if(err)
+ return callback(err);
+
+ if(topicData.deleted === '1')
+ return callback(null);
if(postData.content)
postData.content = utils.strip_tags(postTools.markdownToHTML(postData.content));
postData.relativeTime = utils.relativeTime(postData.timestamp);
- postData.topicSlug = topicSlug;
+ postData.topicSlug = topicData.slug;
posts.push(postData);
callback(null);
});
diff --git a/src/threadTools.js b/src/threadTools.js
index b3a4a9de01..0e2e2370e3 100644
--- a/src/threadTools.js
+++ b/src/threadTools.js
@@ -160,7 +160,7 @@ var RDB = require('./redis.js'),
if (privileges.editable) {
topics.setTopicField(tid, 'pinned', 0);
- topics.getTopicFields(tid, ['cid', 'lastposttime'], function(topicData) {
+ topics.getTopicFields(tid, ['cid', 'lastposttime'], function(err, topicData) {
RDB.zadd('categories:' + topicData.cid + ':tid', topicData.lastposttime, tid);
});
if (socket) {
@@ -180,7 +180,7 @@ var RDB = require('./redis.js'),
ThreadTools.move = function(tid, cid, socket) {
- topics.getTopicFields(tid, ['cid', 'lastposttime'], function(topicData) {
+ topics.getTopicFields(tid, ['cid', 'lastposttime'], function(err, topicData) {
var oldCid = topicData.cid;
var multi = RDB.multi();
diff --git a/src/topics.js b/src/topics.js
index 1592fbcef9..9099a32bfe 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -649,14 +649,7 @@ marked.setOptions({
}
Topics.getTopicFields = function(tid, fields, callback) {
- RDB.hmgetObject('topic:' + tid, fields, function(err, data) {
- if(err === null) {
- callback(data);
- }
- else {
- console.log(err);
- }
- });
+ RDB.hmgetObject('topic:' + tid, fields, callback);
}
Topics.setTopicField = function(tid, field, value) {