diff --git a/src/utils.ts b/src/utils.ts index eca9a2a7..9cde0e59 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -83,7 +83,7 @@ async function adminRedactUserMessagesIn( ) { const body = { limit: limit, rooms: targetRooms }; const redactEndpoint = `/_synapse/admin/v1/user/${userId}/redact`; - const response = await client.doRequest("GET", redactEndpoint, null, body); + const response = await client.doRequest("POST", redactEndpoint, null, body); const redactID = response["redact_id"]; await managementRoom.logMessage( LogLevel.INFO, diff --git a/test/integration/commands/redactCommandTest.ts b/test/integration/commands/redactCommandTest.ts index aa2da561..2eade017 100644 --- a/test/integration/commands/redactCommandTest.ts +++ b/test/integration/commands/redactCommandTest.ts @@ -67,6 +67,10 @@ describe("Test: The redaction command - if admin", function () { moderator.stop(); } + function delay(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); + } + await delay(700); await getMessagesByUserIn(moderator, badUserId, targetRoom, 1000, function (events) { events.map((e) => { if (e.type === "m.room.member") { @@ -75,7 +79,7 @@ describe("Test: The redaction command - if admin", function () { 1, "Only membership should be left on the membership even when it has been redacted.", ); - } else if (Object.keys(e.content).length !== 0) { + } else if (Object.keys(e.content).length !== 0 && e.type != "m.room.redaction") { throw new Error(`This event should have been redacted: ${JSON.stringify(e, null, 2)}`); } });