forked from MirrorHub/synapse
Support stable MSC1772 spaces identifiers. (#9915)
Support both the unstable and stable identifiers. A future release will disable the unstable identifiers.
This commit is contained in:
parent
ef889c98a6
commit
e2a443550e
3 changed files with 10 additions and 2 deletions
1
changelog.d/9915.feature
Normal file
1
changelog.d/9915.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Support stable identifiers from [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772).
|
|
@ -110,6 +110,8 @@ class EventTypes:
|
||||||
|
|
||||||
Dummy = "org.matrix.dummy_event"
|
Dummy = "org.matrix.dummy_event"
|
||||||
|
|
||||||
|
SpaceChild = "m.space.child"
|
||||||
|
SpaceParent = "m.space.parent"
|
||||||
MSC1772_SPACE_CHILD = "org.matrix.msc1772.space.child"
|
MSC1772_SPACE_CHILD = "org.matrix.msc1772.space.child"
|
||||||
MSC1772_SPACE_PARENT = "org.matrix.msc1772.space.parent"
|
MSC1772_SPACE_PARENT = "org.matrix.msc1772.space.parent"
|
||||||
|
|
||||||
|
@ -174,6 +176,7 @@ class EventContentFields:
|
||||||
SELF_DESTRUCT_AFTER = "org.matrix.self_destruct_after"
|
SELF_DESTRUCT_AFTER = "org.matrix.self_destruct_after"
|
||||||
|
|
||||||
# cf https://github.com/matrix-org/matrix-doc/pull/1772
|
# cf https://github.com/matrix-org/matrix-doc/pull/1772
|
||||||
|
ROOM_TYPE = "m.type"
|
||||||
MSC1772_ROOM_TYPE = "org.matrix.msc1772.type"
|
MSC1772_ROOM_TYPE = "org.matrix.msc1772.type"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,7 @@ class SpaceSummaryHandler:
|
||||||
ev.data
|
ev.data
|
||||||
for ev in res.events
|
for ev in res.events
|
||||||
if ev.event_type == EventTypes.MSC1772_SPACE_CHILD
|
if ev.event_type == EventTypes.MSC1772_SPACE_CHILD
|
||||||
|
or ev.event_type == EventTypes.SpaceChild
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _is_room_accessible(self, room_id: str, requester: Optional[str]) -> bool:
|
async def _is_room_accessible(self, room_id: str, requester: Optional[str]) -> bool:
|
||||||
|
@ -331,7 +332,9 @@ class SpaceSummaryHandler:
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: update once MSC1772 lands
|
# TODO: update once MSC1772 lands
|
||||||
room_type = create_event.content.get(EventContentFields.MSC1772_ROOM_TYPE)
|
room_type = create_event.content.get(EventContentFields.ROOM_TYPE)
|
||||||
|
if not room_type:
|
||||||
|
room_type = create_event.content.get(EventContentFields.MSC1772_ROOM_TYPE)
|
||||||
|
|
||||||
entry = {
|
entry = {
|
||||||
"room_id": stats["room_id"],
|
"room_id": stats["room_id"],
|
||||||
|
@ -360,8 +363,9 @@ class SpaceSummaryHandler:
|
||||||
[
|
[
|
||||||
event_id
|
event_id
|
||||||
for key, event_id in current_state_ids.items()
|
for key, event_id in current_state_ids.items()
|
||||||
# TODO: update once MSC1772 lands
|
# TODO: update once MSC1772 has been FCP for a period of time.
|
||||||
if key[0] == EventTypes.MSC1772_SPACE_CHILD
|
if key[0] == EventTypes.MSC1772_SPACE_CHILD
|
||||||
|
or key[0] == EventTypes.SpaceChild
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue