Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Support stable MSC1772 spaces identifiers. #9915

Merged
merged 2 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/9915.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support stable identifiers from [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772).
3 changes: 3 additions & 0 deletions synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class EventTypes:

Dummy = "org.matrix.dummy_event"

SpaceChild = "m.space.child"
SpaceParent = "m.space.parent"
MSC1772_SPACE_CHILD = "org.matrix.msc1772.space.child"
MSC1772_SPACE_PARENT = "org.matrix.msc1772.space.parent"

Expand Down Expand Up @@ -174,6 +176,7 @@ class EventContentFields:
SELF_DESTRUCT_AFTER = "org.matrix.self_destruct_after"

# cf https://github.com/matrix-org/matrix-doc/pull/1772
ROOM_TYPE = "m.type"
MSC1772_ROOM_TYPE = "org.matrix.msc1772.type"


Expand Down
8 changes: 6 additions & 2 deletions synapse/handlers/space_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ async def _summarize_remote_room(
ev.data
for ev in res.events
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:
Expand Down Expand Up @@ -331,7 +332,9 @@ async def _build_room_entry(self, room_id: str) -> JsonDict:
)

# 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 = {
"room_id": stats["room_id"],
Expand Down Expand Up @@ -360,8 +363,9 @@ async def _get_child_events(self, room_id: str) -> Iterable[EventBase]:
[
event_id
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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was suggested to do this when we stabilize the spaces summary MSC.

if key[0] == EventTypes.MSC1772_SPACE_CHILD
or key[0] == EventTypes.SpaceChild
]
)

Expand Down