mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 09:23:51 +01:00
Use same ensureUserInvited method everywere. Fixes #529
This commit is contained in:
parent
35ed840a36
commit
08d5b10902
2 changed files with 3 additions and 10 deletions
|
@ -41,9 +41,9 @@ func (br *WABridge) CreatePrivatePortal(roomID id.RoomID, brInviter bridge.User,
|
|||
return
|
||||
}
|
||||
|
||||
err := portal.MainIntent().EnsureInvited(portal.MXID, inviter.MXID)
|
||||
if err != nil {
|
||||
br.Log.Warnfln("Failed to invite %s to existing private chat portal %s with %s: %v. Redirecting portal to new room...", inviter.MXID, portal.MXID, puppet.JID, err)
|
||||
ok := portal.ensureUserInvited(inviter)
|
||||
if !ok {
|
||||
br.Log.Warnfln("Failed to invite %s to existing private chat portal %s with %s. Redirecting portal to new room...", inviter.MXID, portal.MXID, puppet.JID)
|
||||
br.createPrivatePortalFromInvite(roomID, inviter, puppet, portal)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1131,13 +1131,6 @@ func (portal *Portal) UpdateMetadata(user *User, groupInfo *types.GroupInfo) boo
|
|||
return update
|
||||
}
|
||||
|
||||
func (portal *Portal) ensureMXIDInvited(mxid id.UserID) {
|
||||
err := portal.MainIntent().EnsureInvited(portal.MXID, mxid)
|
||||
if err != nil {
|
||||
portal.log.Warnfln("Failed to ensure %s is invited to %s: %v", mxid, portal.MXID, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (portal *Portal) ensureUserInvited(user *User) bool {
|
||||
return user.ensureInvited(portal.MainIntent(), portal.MXID, portal.IsPrivateChat())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue