make the bridge homeserver the default on via key space state

This commit is contained in:
Helder Ferreira 2021-12-29 14:25:12 +00:00
parent dfa845efb4
commit 3ec67ed434
No known key found for this signature in database
GPG key ID: 3848724EAD604B85

View file

@ -1141,7 +1141,7 @@ func (portal *Portal) CreateMatrixRoom(user *User, groupInfo *types.GroupInfo, i
portal.ensureUserInvited(user)
user.syncChatDoublePuppetDetails(portal, true)
portal.addToSpace(user.getSpaceRoom(), portal.MXID)
portal.addToSpace(user.getSpaceRoom(), portal.MXID, portal.bridge.Config.Homeserver.Domain)
if groupInfo != nil {
portal.SyncParticipants(user, groupInfo)
@ -1178,12 +1178,13 @@ func (portal *Portal) CreateMatrixRoom(user *User, groupInfo *types.GroupInfo, i
return nil
}
func (portal *Portal) addToSpace(spaceID id.RoomID, portalID id.RoomID) {
func (portal *Portal) addToSpace(spaceID id.RoomID, portalID id.RoomID, homeserverDomain string) {
parentSpaceContent := make(map[string]interface{})
parentSpaceContent["via"] = []string{"matrix.wounn.xyz"}
parentSpaceContent["via"] = []string{homeserverDomain}
portal.log.Debugfln("adding room %s to the space %s", portalID, spaceID)
portal.log.Errorln("adding room " + portalID + " to the space " + spaceID)
portal.MainIntent().SendStateEvent(spaceID, event.Type{Type: "m.space.child", Class: event.StateEventType}, portalID.String(), parentSpaceContent)
}