mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
MSC2946: Use new MSC1772 format for space parents (#1713)
This commit is contained in:
parent
2626525c65
commit
5366c33885
3 changed files with 14 additions and 23 deletions
|
@ -36,7 +36,7 @@ import (
|
|||
const (
|
||||
ConstCreateEventContentKey = "org.matrix.msc1772.type"
|
||||
ConstSpaceChildEventType = "org.matrix.msc1772.space.child"
|
||||
ConstSpaceParentEventType = "org.matrix.msc1772.room.parent"
|
||||
ConstSpaceParentEventType = "org.matrix.msc1772.space.parent"
|
||||
)
|
||||
|
||||
// SpacesRequest is the request body to POST /_matrix/client/r0/rooms/{roomID}/spaces
|
||||
|
@ -57,7 +57,7 @@ type SpacesResponse struct {
|
|||
NextBatch string `json:"next_batch"`
|
||||
// Rooms are nodes on the space graph.
|
||||
Rooms []Room `json:"rooms"`
|
||||
// Events are edges on the space graph, exclusively m.space.child or m.room.parent events
|
||||
// Events are edges on the space graph, exclusively m.space.child or m.space.parent events
|
||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,8 @@ func (w *walker) walk() *SpacesResponse {
|
|||
if !w.authorised(roomID) {
|
||||
continue
|
||||
}
|
||||
// Get all `m.space.child` and `m.room.parent` state events for the room. *In addition*, get
|
||||
// all `m.space.child` and `m.room.parent` state events which *point to* (via `state_key` or `content.room_id`)
|
||||
// Get all `m.space.child` and `m.space.parent` state events for the room. *In addition*, get
|
||||
// all `m.space.child` and `m.space.parent` state events which *point to* (via `state_key` or `content.room_id`)
|
||||
// this room. This requires servers to store reverse lookups.
|
||||
refs, err := w.references(roomID)
|
||||
if err != nil {
|
||||
|
@ -196,7 +196,7 @@ func (w *walker) walk() *SpacesResponse {
|
|||
if !w.alreadySent(roomID) {
|
||||
pubRoom := w.publicRoomsChunk(roomID)
|
||||
roomType := ""
|
||||
create := w.stateEvent(roomID, "m.room.create", "")
|
||||
create := w.stateEvent(roomID, gomatrixserverlib.MRoomCreate, "")
|
||||
if create != nil {
|
||||
roomType = gjson.GetBytes(create.Content(), ConstCreateEventContentKey).Str
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue