parent
17d68443b7
commit
e19f8c7532
2 changed files with 7 additions and 3 deletions
|
@ -873,9 +873,13 @@ func (handler *CommandHandler) CommandPM(ce *CommandEvent) {
|
||||||
puppet.Sync(user, contact)
|
puppet.Sync(user, contact)
|
||||||
portal := user.bridge.GetPortalByJID(database.NewPortalKey(contact.JID, user.JID))
|
portal := user.bridge.GetPortalByJID(database.NewPortalKey(contact.JID, user.JID))
|
||||||
if len(portal.MXID) > 0 {
|
if len(portal.MXID) > 0 {
|
||||||
err := portal.MainIntent().EnsureInvited(portal.MXID, user.MXID)
|
var err error
|
||||||
|
if !user.IsRelaybot {
|
||||||
|
err = portal.MainIntent().EnsureInvited(portal.MXID, user.MXID)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portal.log.Warnfln("Failed to invite %s to portal: %v. Creating new portal", user.MXID, err)
|
portal.log.Warnfln("Failed to invite %s to portal: %v. Creating new portal", user.MXID, err)
|
||||||
|
portal.MXID = ""
|
||||||
} else {
|
} else {
|
||||||
ce.Reply("You already have a private chat portal with that user at [%s](https://matrix.to/#/%s)", puppet.Displayname, portal.MXID)
|
ce.Reply("You already have a private chat portal with that user at [%s](https://matrix.to/#/%s)", puppet.Displayname, portal.MXID)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ func (portal *Portal) CreateMatrixRoom(user *User) error {
|
||||||
if metadata.Announce {
|
if metadata.Announce {
|
||||||
portal.RestrictMessageSending(metadata.Announce)
|
portal.RestrictMessageSending(metadata.Announce)
|
||||||
}
|
}
|
||||||
} else {
|
} else if !user.IsRelaybot {
|
||||||
customPuppet := portal.bridge.GetPuppetByCustomMXID(user.MXID)
|
customPuppet := portal.bridge.GetPuppetByCustomMXID(user.MXID)
|
||||||
if customPuppet != nil && customPuppet.CustomIntent() != nil {
|
if customPuppet != nil && customPuppet.CustomIntent() != nil {
|
||||||
_ = customPuppet.CustomIntent().EnsureJoined(portal.MXID)
|
_ = customPuppet.CustomIntent().EnsureJoined(portal.MXID)
|
||||||
|
@ -1132,7 +1132,7 @@ func (portal *Portal) CreateMatrixRoom(user *User) error {
|
||||||
portal.SyncBroadcastRecipients(broadcastMetadata)
|
portal.SyncBroadcastRecipients(broadcastMetadata)
|
||||||
}
|
}
|
||||||
inCommunity := user.addPortalToCommunity(portal)
|
inCommunity := user.addPortalToCommunity(portal)
|
||||||
if portal.IsPrivateChat() {
|
if portal.IsPrivateChat() && !user.IsRelaybot {
|
||||||
puppet := user.bridge.GetPuppetByJID(portal.Key.JID)
|
puppet := user.bridge.GetPuppetByJID(portal.Key.JID)
|
||||||
user.addPuppetToCommunity(puppet)
|
user.addPuppetToCommunity(puppet)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue