|
@@ -424,7 +424,11 @@ func (portal *Portal) CreateMatrixRoom(user *User, channel *discordgo.Channel) e
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- portal.updateSpace(user)
|
|
|
+ if portal.GuildID == "" {
|
|
|
+ user.addPrivateChannelToSpace(portal)
|
|
|
+ } else {
|
|
|
+ portal.updateSpace()
|
|
|
+ }
|
|
|
portal.ensureUserInvited(user)
|
|
|
user.syncChatDoublePuppetDetails(portal, true)
|
|
|
|
|
@@ -1704,21 +1708,11 @@ func (portal *Portal) ExpectedSpaceID() id.RoomID {
|
|
|
return ""
|
|
|
}
|
|
|
|
|
|
-func (portal *Portal) IsInSpace(user *User) bool {
|
|
|
- if portal.GuildID == "" {
|
|
|
- return user.IsInSpace(portal.Key.ChannelID)
|
|
|
- } else {
|
|
|
- return portal.ExpectedSpaceID() == portal.InSpace
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-func (portal *Portal) updateSpace(user *User) bool {
|
|
|
+func (portal *Portal) updateSpace() bool {
|
|
|
if portal.MXID == "" {
|
|
|
return false
|
|
|
}
|
|
|
- if portal.GuildID == "" {
|
|
|
- user.addPrivateChannelToSpace(portal)
|
|
|
- } else if portal.Parent != nil {
|
|
|
+ if portal.Parent != nil {
|
|
|
return portal.addToSpace(portal.Parent.MXID)
|
|
|
} else if portal.Guild != nil {
|
|
|
return portal.addToSpace(portal.Guild.MXID)
|
|
@@ -1781,8 +1775,9 @@ func (portal *Portal) UpdateInfo(source *User, meta *discordgo.Channel) *discord
|
|
|
}
|
|
|
changed = portal.UpdateTopic(meta.Topic) || changed
|
|
|
changed = portal.UpdateParent(meta.ParentID) || changed
|
|
|
- if portal.MXID != "" && !portal.IsInSpace(source) {
|
|
|
- changed = portal.updateSpace(source) || changed
|
|
|
+ // Private channels are added to the space in User.handlePrivateChannel
|
|
|
+ if portal.GuildID != "" && portal.MXID != "" && portal.ExpectedSpaceID() != portal.InSpace {
|
|
|
+ changed = portal.updateSpace() || changed
|
|
|
}
|
|
|
if changed {
|
|
|
portal.UpdateBridgeInfo()
|