-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the abuse report test more readable #284
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifying is always good :)
await goodUser.doRequest("POST", `/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/report/${encodeURIComponent(badEventId)}`); | ||
reportsToFind.push({ | ||
let reportsToFind = [ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Text report, no comment.
}); | ||
reportsToFind.push({ | ||
}, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Text report, with a comment.
await goodUser.doRequest("POST", `/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/report/${encodeURIComponent(badEventId3)}`, ""); | ||
reportsToFind.push({ | ||
}, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Report containing embedded html, no comment.
await goodUser.doRequest("POST", `/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/report/${encodeURIComponent(badEventId4)}`, ""); | ||
reportsToFind.push({ | ||
}, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Report containing long that should be truncated by the report manager because it is too long.
await goodUser.doRequest("POST", `/_matrix/client/r0/rooms/${encodeURIComponent(roomId)}/report/${encodeURIComponent(badEventId5)}`, ""); | ||
reportsToFind.push({ | ||
}, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Report containing long that should be truncated by the report manager because it contains too many newlines.
console.error("Could not send fifth report", e.body || e); | ||
throw e; | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit ;
.
null, | ||
report.comment ? { reason: report.comment } : null | ||
); | ||
reportsToFind.push(report); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the report already in reportsToFind
?
@@ -276,6 +257,7 @@ describe("Test: Reporting abuse", async () => { | |||
await new Promise(resolve => setTimeout(resolve, 1000)); | |||
|
|||
let mjolnirRooms = new Set(await matrixClient().getJoinedRooms()); | |||
// but you invited them???? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand that comment.
if (roomId = this.mjolnir.managementRoomId) { | ||
notices.push(event); | ||
} | ||
if (notices.length === reportsToFind.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be more comfortable if we made this a set or a map and removed reports as they arrive.
I don't think this is complete, but this test was extremely difficult to debug before #282 was discovered (and would still be).