From fb691b23b40405b3fc4a33307c0702140af7056a Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 1 Mar 2014 22:03:21 -0500 Subject: [PATCH] moved topic locked check to topic.reply --- src/posts.js | 7 ------- src/topics.js | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) 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) {