mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2025-01-18 18:32:05 +01:00
backfill: don't create room if the user is not a participant
This can happen if the user gets kicked from a chat.
This commit is contained in:
parent
5aee338561
commit
2afdf80937
1 changed files with 7 additions and 1 deletions
|
@ -1221,7 +1221,13 @@ func (portal *Portal) CreateMatrixRoom(user *User, groupInfo *types.GroupInfo, i
|
||||||
} else {
|
} else {
|
||||||
if groupInfo == nil || !isFullInfo {
|
if groupInfo == nil || !isFullInfo {
|
||||||
foundInfo, err := user.Client.GetGroupInfo(portal.Key.JID)
|
foundInfo, err := user.Client.GetGroupInfo(portal.Key.JID)
|
||||||
if err != nil {
|
|
||||||
|
// Ensure that the user is actually a participant in the conversation
|
||||||
|
// before creating the matrix room
|
||||||
|
if errors.Is(err, whatsmeow.ErrNotInGroup) {
|
||||||
|
user.log.Debugfln("Skipping creating matrix room for %s because the user is not a participant", portal.Key.JID)
|
||||||
|
return err
|
||||||
|
} else if err != nil {
|
||||||
portal.log.Warnfln("Failed to get group info through %s: %v", user.JID, err)
|
portal.log.Warnfln("Failed to get group info through %s: %v", user.JID, err)
|
||||||
} else {
|
} else {
|
||||||
groupInfo = foundInfo
|
groupInfo = foundInfo
|
||||||
|
|
Loading…
Add table
Reference in a new issue