mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-10-22 17:11:17 +00:00
This commit is contained in:
9 files changed
+45
-16
No files matched your search
@@ -49,7 +49,11 @@ import {
|
||||
userLocalpart,
|
||||
} from "@the-draupnir-project/matrix-basic-types";
|
||||
import { TopLevelStores } from "../backingstore/DraupnirStores";
|
||||
import { loadOrCreateZeroTouchDeployRoom, ZERO_TOUCH_DEPLOY_ROOM_ACCOUNT_DATA_TYPE, ZeroTouchDeployRoomAccountDataSchema } from "../managedRoomAccountData";
|
||||
import {
|
||||
loadOrCreateZeroTouchDeployRoom,
|
||||
ZERO_TOUCH_DEPLOY_ROOM_ACCOUNT_DATA_TYPE,
|
||||
ZeroTouchDeployRoomAccountDataSchema,
|
||||
} from "../managedRoomAccountData";
|
||||
|
||||
const log = new Logger("AppServiceDraupnirManager");
|
||||
|
||||
|
||||
@@ -194,15 +194,12 @@ export class TrustedReporters
|
||||
}
|
||||
|
||||
if (met.length > 0) {
|
||||
await this.draupnir.client.sendMessage(
|
||||
this.draupnir.managementRoomID,
|
||||
{
|
||||
msgtype: "m.notice",
|
||||
body:
|
||||
`message ${report.event_id} reported by ${[...reporters].join(", ")}. ` +
|
||||
`actions: ${met.join(", ")}`,
|
||||
}
|
||||
);
|
||||
await this.draupnir.client.sendMessage(this.draupnir.managementRoomID, {
|
||||
msgtype: "m.notice",
|
||||
body:
|
||||
`message ${report.event_id} reported by ${[...reporters].join(", ")}. ` +
|
||||
`actions: ${met.join(", ")}`,
|
||||
});
|
||||
}
|
||||
return Ok(undefined);
|
||||
}
|
||||
|
||||
@@ -14,13 +14,18 @@ describe("Managed room bootstrap startup integration", function (this: Mocha.Sui
|
||||
const initialManager = await newTestUser(config.homeserver.url, {
|
||||
name: { contains: "managed-admin" },
|
||||
});
|
||||
config.managedAdminRoom = true;
|
||||
config.adminRoom = undefined;
|
||||
config.initialManager = (await initialManager.getUserId()) as StringUserID;
|
||||
const testConfigRecord = {
|
||||
...(config as unknown as Record<string, unknown>),
|
||||
};
|
||||
testConfigRecord.managedAdminRoom = true;
|
||||
testConfigRecord.adminRoom = undefined;
|
||||
testConfigRecord.initialManager =
|
||||
(await initialManager.getUserId()) as StringUserID;
|
||||
const testConfig = testConfigRecord as typeof config;
|
||||
|
||||
let appservice: MjolnirAppService | undefined;
|
||||
try {
|
||||
appservice = await setupHarnessWithConfig(config, {
|
||||
appservice = await setupHarnessWithConfig(testConfig, {
|
||||
ensureAdminRoomAlias: false,
|
||||
});
|
||||
if (appservice.accessControlRoomID.length === 0) {
|
||||
|
||||
@@ -51,6 +51,9 @@ describe("Test: The redaction command", function () {
|
||||
name: { contains: "moderator" },
|
||||
});
|
||||
this.moderator = moderator;
|
||||
if (this.config.managementRoom === undefined) {
|
||||
throw new TypeError("managementRoom is required for this test");
|
||||
}
|
||||
await moderator.joinRoom(this.config.managementRoom);
|
||||
const targetRoom = await moderator.createRoom({
|
||||
invite: [await badUser.getUserId(), mjolnirUserId],
|
||||
@@ -158,6 +161,9 @@ describe("Test: The redaction command", function () {
|
||||
name: { contains: "moderator" },
|
||||
});
|
||||
this.moderator = moderator;
|
||||
if (this.config.managementRoom === undefined) {
|
||||
throw new TypeError("managementRoom is required for this test");
|
||||
}
|
||||
await moderator.joinRoom(this.config.managementRoom);
|
||||
const targetRooms: string[] = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
@@ -260,6 +266,9 @@ describe("Test: The redaction command", function () {
|
||||
name: { contains: "moderator" },
|
||||
});
|
||||
this.moderator = moderator;
|
||||
if (this.config.managementRoom === undefined) {
|
||||
throw new TypeError("managementRoom is required for this test");
|
||||
}
|
||||
await moderator.joinRoom(this.config.managementRoom);
|
||||
const targetRoom = await moderator.createRoom({
|
||||
invite: [await badUser.getUserId(), draupnir.clientUserID],
|
||||
|
||||
@@ -36,6 +36,9 @@ describe("Test: The rooms commands", function () {
|
||||
name: { contains: "moderator" },
|
||||
});
|
||||
this.moderator = moderator;
|
||||
if (this.config.managementRoom === undefined) {
|
||||
throw new TypeError("managementRoom is required for this test");
|
||||
}
|
||||
await moderator.joinRoom(this.config.managementRoom);
|
||||
const targetRoom = await moderator.createRoom({
|
||||
invite: [draupnir.clientUserID],
|
||||
|
||||
@@ -81,7 +81,9 @@ export const mochaHooks = {
|
||||
this.timeout(30000);
|
||||
this.lifetime = new StandardLifetime();
|
||||
const config = (this.config = configRead());
|
||||
this.managementRoomAlias = config.managementRoom;
|
||||
if (config.managementRoom !== undefined) {
|
||||
this.managementRoomAlias = config.managementRoom;
|
||||
}
|
||||
const storagePath = getStoragePath(config.dataPath);
|
||||
await cleanUpTopLevelStores(storagePath);
|
||||
this.stores = makeTopLevelStores(storagePath, DefaultEventDecoder, {
|
||||
|
||||
@@ -38,6 +38,9 @@ describe("Test: !help command", function (this: Mocha.Suite) {
|
||||
if (draupnir === undefined) {
|
||||
throw new TypeError(`setup code is wrong`);
|
||||
}
|
||||
if (this.config.managementRoom === undefined) {
|
||||
throw new TypeError("managementRoom is required for this test");
|
||||
}
|
||||
await client.joinRoom(this.config.managementRoom);
|
||||
// listener for getting the event reply
|
||||
const reply = new Promise((resolve) => {
|
||||
|
||||
@@ -34,7 +34,10 @@ import {
|
||||
} from "matrix-protection-suite";
|
||||
import { SafeModeDraupnir } from "../../src/safemode/DraupnirSafeMode";
|
||||
import { TopLevelStores } from "../../src/backingstore/DraupnirStores";
|
||||
import { isStringUserID, userLocalpart } from "@the-draupnir-project/matrix-basic-types";
|
||||
import {
|
||||
isStringUserID,
|
||||
userLocalpart,
|
||||
} from "@the-draupnir-project/matrix-basic-types";
|
||||
|
||||
patchMatrixClient();
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ describe("Test: utils", function () {
|
||||
it(
|
||||
"replaceRoomIdsWithPills correctly turns a room ID in to a pill",
|
||||
async function (this: DraupnirTestContext) {
|
||||
if (this.config.managementRoom === undefined) {
|
||||
throw new TypeError("managementRoom is required for this test");
|
||||
}
|
||||
const managementRoomAlias = this.config.managementRoom;
|
||||
const draupnir = this.draupnir;
|
||||
const draupnirMatrixClient = draupnirSafeEmitter();
|
||||
|
||||
Reference in new issue
Block a user