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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := portal.MainIntent().EnsureInvited(portal.MXID, inviter.MXID)
|
ok := portal.ensureUserInvited(inviter)
|
||||||
if err != nil {
|
if !ok {
|
||||||
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)
|
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)
|
br.createPrivatePortalFromInvite(roomID, inviter, puppet, portal)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1131,13 +1131,6 @@ func (portal *Portal) UpdateMetadata(user *User, groupInfo *types.GroupInfo) boo
|
||||||
return update
|
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 {
|
func (portal *Portal) ensureUserInvited(user *User) bool {
|
||||||
return user.ensureInvited(portal.MainIntent(), portal.MXID, portal.IsPrivateChat())
|
return user.ensureInvited(portal.MainIntent(), portal.MXID, portal.IsPrivateChat())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue