mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed issue with suggested being duplicated and RESTApi posting
This commit is contained in:
@@ -308,15 +308,15 @@ function del(params, socket, socketid) {
|
||||
if(docs !== null && docs.length !== 0 && docs[0].adminpass == Functions.hash_pass(Functions.decrypt_string(socketid, params.adminpass)))
|
||||
{
|
||||
db.collection(coll).find({id:params.id}, function(err, docs){
|
||||
dont_increment = true;
|
||||
var dont_increment = false;
|
||||
if(docs[0]){
|
||||
if(docs[0].type == "suggested"){
|
||||
dont_increment = false;
|
||||
dont_increment = true;
|
||||
}
|
||||
db.collection(coll).remove({id:params.id}, function(err, docs){
|
||||
socket.emit("toast", "deletesong");
|
||||
io.to(coll).emit("channel", {type:"deleted", value: params.id});
|
||||
if(dont_increment) db.collection("frontpage_lists").update({_id: coll, count: {$gt: 0}}, {$inc: {count: -1}, $set:{accessed: Functions.get_time()}}, {upsert: true}, function(err, docs){});
|
||||
if(!dont_increment) db.collection("frontpage_lists").update({_id: coll, count: {$gt: 0}}, {$inc: {count: -1}, $set:{accessed: Functions.get_time()}}, {upsert: true}, function(err, docs){});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user