mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
check post exists before delete restore
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user