mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 21:47:02 +03:00
Fix shadow hidden endpoint
This commit is contained in:
@@ -18,12 +18,7 @@ module.exports = async function shadowBanUser(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if enabled is false and the old submissions should be made visible again
|
//if enabled is false and the old submissions should be made visible again
|
||||||
let unHideOldSubmissions = req.query.unHideOldSubmissions;
|
let unHideOldSubmissions = req.query.unHideOldSubmissions !== "false";
|
||||||
if (enabled === undefined){
|
|
||||||
unHideOldSubmissions = true;
|
|
||||||
} else {
|
|
||||||
unHideOldSubmissions = unHideOldSubmissions === "true";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adminUserIDInput == undefined || userID == undefined) {
|
if (adminUserIDInput == undefined || userID == undefined) {
|
||||||
//invalid request
|
//invalid request
|
||||||
@@ -50,7 +45,9 @@ module.exports = async function shadowBanUser(req, res) {
|
|||||||
privateDB.prepare('run', "INSERT INTO shadowBannedUsers VALUES(?)", [userID]);
|
privateDB.prepare('run', "INSERT INTO shadowBannedUsers VALUES(?)", [userID]);
|
||||||
|
|
||||||
//find all previous submissions and hide them
|
//find all previous submissions and hide them
|
||||||
db.prepare('run', "UPDATE sponsorTimes SET shadowHidden = 1 WHERE userID = ?", [userID]);
|
if (unHideOldSubmissions) {
|
||||||
|
db.prepare('run', "UPDATE sponsorTimes SET shadowHidden = 1 WHERE userID = ?", [userID]);
|
||||||
|
}
|
||||||
} else if (!enabled && row.userCount > 0) {
|
} else if (!enabled && row.userCount > 0) {
|
||||||
//remove them from the shadow ban list
|
//remove them from the shadow ban list
|
||||||
privateDB.prepare('run', "DELETE FROM shadowBannedUsers WHERE userID = ?", [userID]);
|
privateDB.prepare('run', "DELETE FROM shadowBannedUsers WHERE userID = ?", [userID]);
|
||||||
|
|||||||
Reference in New Issue
Block a user