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