Skip to content

Commit 9d0f23c

Browse files
committed
canonical-json: Apply redaction rules of MSC3821
1 parent 5d68ba3 commit 9d0f23c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

crates/ruma-common/CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ Breaking changes:
3333
in room version 11, according to MSC2175 / MSC3820 / Matrix 1.8
3434
- `RoomCreateEventContent::new()` was renamed to `new_v1()`
3535
- `RedactedRoomCreateEventContent` is now a typedef over `RoomCreateEventContent`
36-
- Add preserved fields to match the new redaction algorithm in room version 11, according to
37-
MSC2176 / MSC3821 / MSC3820 / Matrix 1.8, for the following types:
38-
- `RedactedRoomRedactionEventContent`,
39-
- `RedactedRoomPowerLevelsEventContent`,
40-
- `RedactedRoomMemberEventContent`
4136
- `RoomMessageEventContent::make_reply_to()` and `make_for_thread()` have an extra parameter to
4237
support the recommended behavior for intentional mentions in replies according to Matrix 1.7
4338
- In Markdown, soft line breaks are transformed into hard line breaks when compiled into HTML.
@@ -75,6 +70,13 @@ Improvements:
7570
- Make the generated and stripped plain text reply fallback behavior more compatible with most
7671
of the Matrix ecosystem.
7772
- Add support for intentional mentions according to MSC3952 / Matrix 1.7
73+
- Add support for room version 11 according to MSC3820
74+
- Adapt the redaction algorithm in `canonical_json`
75+
- Add preserved fields to match the new redaction algorithm, according to
76+
MSC2176 / MSC3821, for the following types:
77+
- `RedactedRoomRedactionEventContent`,
78+
- `RedactedRoomPowerLevelsEventContent`,
79+
- `RedactedRoomMemberEventContent`
7880

7981
# 0.11.3
8082

crates/ruma-common/src/canonical_json.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,14 @@ static ROOM_MEMBER_V1: AllowedKeys = AllowedKeys::some(&["membership"]);
362362
/// Allowed keys in `m.room.member`'s content according to room version 9.
363363
static ROOM_MEMBER_V9: AllowedKeys =
364364
AllowedKeys::some(&["membership", "join_authorised_via_users_server"]);
365+
/// Allowed keys in `m.room.member`'s content according to room version 11.
366+
static ROOM_MEMBER_V11: AllowedKeys = AllowedKeys::some_nested(
367+
&["membership", "join_authorised_via_users_server"],
368+
&[("third_party_invite", &ROOM_MEMBER_THIRD_PARTY_INVITE_V11)],
369+
);
370+
/// Allowed keys in the `third_party_invite` field of `m.room.member`'s content according to room
371+
/// version 11.
372+
static ROOM_MEMBER_THIRD_PARTY_INVITE_V11: AllowedKeys = AllowedKeys::some(&["signed"]);
365373

366374
/// Allowed keys in `m.room.create`'s content according to room version 1.
367375
static ROOM_CREATE_V1: AllowedKeys = AllowedKeys::some(&["creator"]);
@@ -420,7 +428,8 @@ fn allowed_content_keys_for(event_type: &str, version: &RoomVersionId) -> &'stat
420428
| RoomVersionId::V6
421429
| RoomVersionId::V7
422430
| RoomVersionId::V8 => &ROOM_MEMBER_V1,
423-
_ => &ROOM_MEMBER_V9,
431+
RoomVersionId::V9 | RoomVersionId::V10 => &ROOM_MEMBER_V9,
432+
_ => &ROOM_MEMBER_V11,
424433
},
425434
"m.room.create" => match version {
426435
RoomVersionId::V1

0 commit comments

Comments
 (0)