Skip to content

Commit

Permalink
Fix call to admin redaction api (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay authored Jan 23, 2025
1 parent 405dd9d commit 8ae1e32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion test/integration/commands/redactCommandTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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)}`);
}
});
Expand Down

0 comments on commit 8ae1e32

Please sign in to comment.