diff --git a/databases/_upgrade_sponsorTimes_17.sql b/databases/_upgrade_sponsorTimes_17.sql index 7db65c8..43b5ecf 100644 --- a/databases/_upgrade_sponsorTimes_17.sql +++ b/databases/_upgrade_sponsorTimes_17.sql @@ -9,10 +9,10 @@ CREATE TABLE "sqlb_temp_table_17" ( "reason" TEXT NOT NULL default '' ); -INSERT INTO sqlb_temp_table_17 SELECT "userID","issueTime","issuerUserID","enabled", "" FROM "warnings"; +INSERT INTO sqlb_temp_table_17 SELECT "userID","issueTime","issuerUserID","enabled", '' FROM "warnings"; DROP TABLE warnings; -ALTER TABLE sqlb_temp_table_17 RENAME TO "warnings";; +ALTER TABLE sqlb_temp_table_17 RENAME TO "warnings"; UPDATE "config" SET value = 17 WHERE key = 'version'; diff --git a/test/cases/postWarning.ts b/test/cases/postWarning.ts index 2c1242f..de15ef1 100644 --- a/test/cases/postWarning.ts +++ b/test/cases/postWarning.ts @@ -12,6 +12,7 @@ describe('postWarning', () => { let json = { issuerUserID: 'warning-vip', userID: 'warning-0', + reason: 'warning-reason-0' }; fetch(getbaseURL() + "/api/warnUser", { @@ -23,8 +24,8 @@ describe('postWarning', () => { }) .then(async res => { if (res.status === 200) { - let row = await db.prepare('get', `SELECT "userID", "issueTime", "issuerUserID", enabled FROM warnings WHERE "userID" = ?`, [json.userID]); - if (row?.enabled == 1 && row?.issuerUserID == getHash(json.issuerUserID)) { + let row = await db.prepare('get', `SELECT "userID", "issueTime", "issuerUserID", enabled, "reason" FROM warnings WHERE "userID" = ?`, [json.userID]); + if (row?.enabled == 1 && row?.issuerUserID == getHash(json.issuerUserID) && row?.reason === json.reason) { done(); } else { done("Warning missing from database");