mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
WIP: Applied feedback
This commit is contained in:
parent
2813cfa2c6
commit
197a20b889
@ -103,6 +103,14 @@ export async function execSinceCommand(destinationRoomId: string, event: any, mj
|
||||
mjolnir.client.unstableApis.addReactionToEvent(destinationRoomId, event['event_id'], '✅');
|
||||
}
|
||||
}
|
||||
|
||||
// Implementation of `execSinceCommand`, counts on caller to print errors.
|
||||
//
|
||||
// This method:
|
||||
// - decodes all the arguments;
|
||||
// - resolves any room alias into a room id;
|
||||
// - attempts to execute action;
|
||||
// - in case of success, returns `{ok: undefined}`, in case of error, returns `{error: string}`.
|
||||
async function execSinceCommandAux(destinationRoomId: string, event: any, mjolnir: Mjolnir, tokens: ParseEntry[]): Promise<Result<undefined>> {
|
||||
const [dateOrDurationToken, actionToken, maxEntriesToken, ...optionalTokens] = tokens;
|
||||
|
||||
@ -160,7 +168,7 @@ async function execSinceCommandAux(destinationRoomId: string, event: any, mjolni
|
||||
const action: Action = actionResult.ok!;
|
||||
|
||||
// Now list affected rooms.
|
||||
const rooms: Set<string> = new Set();
|
||||
const rooms: Set</* room id */string> = new Set();
|
||||
let reasonParts: string[] | undefined;
|
||||
for (let token of optionalTokens) {
|
||||
const maybeArg = getTokenAsString(reasonParts ? "[reason]" : "[room]", token);
|
||||
@ -274,4 +282,4 @@ function makeJoinStatus(mjolnir: Mjolnir, targetRoomId: string, maxEntries: numb
|
||||
html: `${joins.length} recent joins (cut at ${maxAgeHumanReadable} ago / ${maxEntries} entries): <ul> ${htmlFragments.join()} </ul>`,
|
||||
text: `${joins.length} recent joins (cut at ${maxAgeHumanReadable} ago / ${maxEntries} entries):\n${textFragments.join("\n")}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ describe("Test: Testing RoomMemberManager", function() {
|
||||
for (let array of [this.users, this.goodUsers, this.badUsers]) {
|
||||
for (let client of array || []) {
|
||||
await client.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user