check post exists before delete restore

v1.18.x
barisusakli 10 years ago
parent f88d822fe2
commit b301daf126

@ -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) {

Loading…
Cancel
Save