mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
if every post gets deleted in a topic, then the topic deletes itself also
This commit is contained in:
@@ -88,6 +88,15 @@ marked.setOptions({
|
||||
io.sockets.in('topic_' + tid).emit('event:post_deleted', {
|
||||
pid: pid
|
||||
});
|
||||
|
||||
// Delete the thread if it is the last undeleted post
|
||||
threadTools.get_latest_undeleted_pid(tid, function(err, pid) {
|
||||
if (err && err.message === 'no-undeleted-pids-found') {
|
||||
threadTools.delete(tid, -1, function(err) {
|
||||
if (err) console.log('Error: Could not delete topic (tid: ' + tid + ')');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user