Don't fail if parent portal doesn't exist yet
This commit is contained in:
@@ -1428,6 +1428,9 @@ func (portal *Portal) addToSpace(mxid id.RoomID) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
portal.removeFromSpace()
|
portal.removeFromSpace()
|
||||||
|
if mxid == "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
_, err := portal.MainIntent().SendStateEvent(portal.MXID, event.StateSpaceParent, mxid.String(), &event.SpaceParentEventContent{
|
_, err := portal.MainIntent().SendStateEvent(portal.MXID, event.StateSpaceParent, mxid.String(), &event.SpaceParentEventContent{
|
||||||
Via: []string{portal.bridge.AS.HomeserverDomain},
|
Via: []string{portal.bridge.AS.HomeserverDomain},
|
||||||
@@ -1455,7 +1458,7 @@ func (portal *Portal) UpdateParent(parentID string) bool {
|
|||||||
}
|
}
|
||||||
portal.ParentID = parentID
|
portal.ParentID = parentID
|
||||||
if portal.ParentID != "" {
|
if portal.ParentID != "" {
|
||||||
portal.Parent = portal.bridge.GetExistingPortalByID(database.NewPortalKey(parentID, ""))
|
portal.Parent = portal.bridge.GetPortalByID(database.NewPortalKey(parentID, ""), discordgo.ChannelTypeGuildCategory)
|
||||||
} else {
|
} else {
|
||||||
portal.Parent = nil
|
portal.Parent = nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user