mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 03:26:59 +03:00
Compare commits
2 Commits
2d5d3637fd
...
1eedc9fa09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eedc9fa09 | ||
|
|
c1fc6519b4 |
@@ -70,16 +70,6 @@ export async function setUsername(req: Request, res: Response): Promise<Response
|
||||
if (await isUserBanned(hashedUserID)) {
|
||||
return res.sendStatus(200);
|
||||
}
|
||||
|
||||
const [segments, titles, thumbs] = await Promise.all([
|
||||
db.prepare("get", `SELECT count(*) AS "count" FROM "sponsorTimes" WHERE "userID" = ? LIMIT 1`, [hashedUserID]),
|
||||
db.prepare("get", `SELECT count(*) AS "count" FROM "titles" WHERE "userID" = ? LIMIT 1`, [hashedUserID]),
|
||||
db.prepare("get", `SELECT count(*) AS "count" FROM "thumbnails" WHERE "userID" = ? LIMIT 1`, [hashedUserID]),
|
||||
]) as {count: number}[];
|
||||
|
||||
if (segments.count === 0 && titles.count === 0 && thumbs.count === 0) {
|
||||
return res.sendStatus(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) /* istanbul ignore next */ {
|
||||
|
||||
@@ -223,10 +223,4 @@ describe("setUsername", () => {
|
||||
assert.strictEqual(resp.status, 200);
|
||||
await assert.rejects(getUsernameInfo(publicID), "Expected the username change to be silently rejected");
|
||||
});
|
||||
|
||||
it("Should ignore username change requests for new users", async () => {
|
||||
const resp = await postSetUserName(completelyNewUserPrivId, completelyNewUsername);
|
||||
assert.strictEqual(resp.status, 200);
|
||||
await assert.rejects(getUsernameInfo(getHash(completelyNewUserPrivId)), "Expected the username change to be silently rejected");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user