Skip to content

Node.js based forum software built for the modern web

moved topic locked check to topic.reply

Baris Soner Usaklifb691b23b404
diff --git a/src/posts.js b/src/posts.js
index 0afee2166f..ac4a3d5e5a 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -37,13 +37,6 @@ var db = require('./database'),
async.waterfall([
function(next) {
- topics.isLocked(tid, next);
- },
- function(locked, next) {
- if(locked) {
- return next(new Error('topic-locked'));
- }
-
db.incrObjectField('global', 'nextPid', next);
},
function(pid, next) {
diff --git a/src/topics.js b/src/topics.js
index e0c56b52f5..590e5deafd 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -171,6 +171,14 @@ var async = require('async'),
if (!topicExists) {
return next(new Error('topic doesn\'t exist'));
}
+
+ Topics.isLocked(tid, next);
+ },
+ function(locked, next) {
+ if (locked) {
+ return next(new Error('topic-locked'));
+ }
+
threadTools.privileges(tid, uid, next);
},
function(privilegesData, next) {