mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2026-01-28 21:30:53 +03:00
Merge branch 'master' of https://github.com/ajayyy/SponsorBlockServer into Dainius14/master
# Conflicts: # src/routes/shadowBanUser.js # src/routes/voteOnSponsorTime.ts # test/cases/getSkipSegments.js # test/cases/voteOnSponsorTime.js
This commit is contained in:
@@ -2,7 +2,6 @@ import {db, privateDB} from '../databases/databases';
|
||||
import {getHash} from '../utils/getHash';
|
||||
import {Request, Response} from 'express';
|
||||
|
||||
|
||||
export async function shadowBanUser(req: Request, res: Response) {
|
||||
const userID = req.query.userID as string;
|
||||
const hashedIP = req.query.hashedIP as string;
|
||||
@@ -51,7 +50,17 @@ export async function shadowBanUser(req: Request, res: Response) {
|
||||
|
||||
//find all previous submissions and unhide them
|
||||
if (unHideOldSubmissions) {
|
||||
db.prepare('run', "UPDATE sponsorTimes SET shadowHidden = 0 WHERE userID = ?", [userID]);
|
||||
let segmentsToIgnore = db.prepare('all', "SELECT UUID FROM sponsorTimes st "
|
||||
+ "JOIN noSegments ns on st.videoID = ns.videoID AND st.category = ns.category WHERE st.userID = ?"
|
||||
, [userID]).map((item: {UUID: string}) => item.UUID);
|
||||
let allSegments = db.prepare('all', "SELECT UUID FROM sponsorTimes st WHERE st.userID = ?", [userID])
|
||||
.map((item: {UUID: string}) => item.UUID);
|
||||
|
||||
allSegments.filter((item: {uuid: string}) => {
|
||||
return segmentsToIgnore.indexOf(item) === -1;
|
||||
}).forEach((UUID: string) => {
|
||||
db.prepare('run', "UPDATE sponsorTimes SET shadowHidden = 0 WHERE UUID = ?", [UUID]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user