@ -19,6 +19,12 @@ module.exports = function(Posts) {
function togglePostDelete(uid, pid, isDelete, callback) {
async.waterfall([
function (next) {
Posts.exists(pid, next);
},
function (exists, next) {
if (!exists) {
return next(new Error('[[error:no-post]]'));
}
Posts.getPostField(pid, 'deleted', next);
function (deleted, next) {