Skip to content

Commit 73c2bc7

Browse files
authored
Conceputalise prividlidged creators and update MPS with changes to permissions calculation. (#937)
the-draupnir-project/planning#44 * Use `RoomVersionMirror` to determine prividlidged creators. On policy room creation. * Update MPS for prividlidged creators conception. Fixes #935. Fixes #934.
1 parent 5394721 commit 73c2bc7

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
"jsdom": "^24.0.0",
6464
"matrix-appservice-bridge": "^10.3.1",
6565
"matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.7.1-element.6",
66-
"matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@3.10.0",
67-
"matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.10.0",
66+
"matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@3.11.0",
67+
"matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.11.0",
6868
"pg": "^8.8.0",
6969
"yaml": "^2.3.2"
7070
},

src/appservice/AppServiceDraupnirManager.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
ClientsInRoomMap,
2727
Ok,
2828
RoomCreator,
29+
RoomVersionMirror,
2930
Task,
3031
isError,
3132
} from "matrix-protection-suite";
@@ -456,13 +457,15 @@ export async function makeManagementRoom(
456457
"Failed to fetch room versions from client capabilities"
457458
);
458459
}
459-
const isV12OrAboveDefault =
460-
parseInt(capabilities.ok.capabilities["m.room_versions"].default) >= 12;
460+
const isRoomVersionWithPrivilidgedCreators =
461+
RoomVersionMirror.isVersionWithPrivilidgedCreators(
462+
capabilities.ok.capabilities["m.room_versions"].default
463+
);
461464
return await roomCreator.createRoom({
462465
preset: "private_chat",
463466
invite: [requestingUserID],
464467
name: `${requestingUserID}'s Draupnir`,
465-
power_level_content_override: isV12OrAboveDefault
468+
power_level_content_override: isRoomVersionWithPrivilidgedCreators
466469
? {
467470
users: {
468471
[requestingUserID]: 150,

yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,18 +2598,18 @@ matrix-appservice@^2.0.0:
25982598
request-promise "^4.2.6"
25992599
sanitize-html "^2.11.0"
26002600

2601-
"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.10.0":
2602-
version "3.10.0"
2603-
resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-3.10.0.tgz#115ed98ca3634dfe32d2a98db727e2c709ff4adb"
2604-
integrity sha512-zAU/Dy3DBFgOtNWsP3ybwvVdXQjO3ro58ETn+F3BMln1WTGzTbZvvrMrL5F2ooD/uhy0XR4zjfw0Kh98/loFzw==
2601+
"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.11.0":
2602+
version "3.11.0"
2603+
resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-3.11.0.tgz#0f972cd69a918422aca5b05f0f917766b2899e13"
2604+
integrity sha512-fNT0rdGXN8VLZtkqS5s4wySYZPJ3LaqsU/CP3iS4WK7XQ6EXT1n3UM4chxmwL5YhQITRW34PehTx7ScdKpL+4w==
26052605
dependencies:
26062606
"@gnuxie/typescript-result" "^1.0.0"
26072607
await-lock "^2.2.2"
26082608

2609-
"matrix-protection-suite@npm:@gnuxie/matrix-protection-suite@3.10.0":
2610-
version "3.10.0"
2611-
resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite/-/matrix-protection-suite-3.10.0.tgz#0b2f95f39c8124bf519722c35c6d033a3d7cb20e"
2612-
integrity sha512-fa9/n5bdCUy+qGNHAz0m6BAPswtC1bfADMOx+5qDz6HpPKaM8hBnafVJDE/rgG6PybrAkPf8lYR6mTKJJPbXpA==
2609+
"matrix-protection-suite@npm:@gnuxie/matrix-protection-suite@3.11.0":
2610+
version "3.11.0"
2611+
resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite/-/matrix-protection-suite-3.11.0.tgz#2ed31e8bd0c68b89927117090f049b5905c9ed82"
2612+
integrity sha512-Y/on4KzPN8413dNv1zLBP1LaD9ijgZSR7qXPJUZRZHqezEruQp1bg8q2YIOdzsrI5dk/TK2ftTnEC/lbz2aWYA==
26132613
dependencies:
26142614
"@gnuxie/typescript-result" "^1.0.0"
26152615
await-lock "^2.2.2"

0 commit comments

Comments
 (0)