Fix some bugs

This commit is contained in:
Tulir Asokan 2023-07-20 01:54:30 +03:00
parent e0df07e384
commit d7d1abc3b7
3 changed files with 11 additions and 2 deletions

View file

@ -726,6 +726,10 @@ func (portal *Portal) SyncParticipants(source *User, metadata *gmproto.Conversat
} }
portal.zlog.Debug().Interface("participant", participant).Msg("Syncing participant") portal.zlog.Debug().Interface("participant", participant).Msg("Syncing participant")
puppet := source.GetPuppetByID(participant.ID.ParticipantID, participant.ID.Number) puppet := source.GetPuppetByID(participant.ID.ParticipantID, participant.ID.Number)
if puppet == nil {
portal.zlog.Error().Any("participant_id", participant.ID).Msg("Failed to get puppet for participant")
continue
}
userIDs = append(userIDs, puppet.MXID) userIDs = append(userIDs, puppet.MXID)
puppet.Sync(source, participant) puppet.Sync(source, participant)
if portal.MXID != "" { if portal.MXID != "" {

View file

@ -140,8 +140,12 @@ func (br *GMBridge) NewPuppet(dbPuppet *database.Puppet) *Puppet {
return &Puppet{ return &Puppet{
Puppet: dbPuppet, Puppet: dbPuppet,
bridge: br, bridge: br,
log: br.ZLog.With().Str("phone", dbPuppet.Phone).Int("puppet_receiver", dbPuppet.Receiver).Logger(), log: br.ZLog.With().
MXID: br.FormatPuppetMXID(dbPuppet.Key), Str("phone", dbPuppet.Phone).
Str("puppet_id", dbPuppet.ID).
Int("puppet_receiver", dbPuppet.Receiver).
Logger(),
MXID: br.FormatPuppetMXID(dbPuppet.Key),
} }
} }

View file

@ -537,6 +537,7 @@ func (user *User) DeleteConnection() {
defer user.connLock.Unlock() defer user.connLock.Unlock()
user.unlockedDeleteConnection() user.unlockedDeleteConnection()
user.longPollingError = errors.New("not connected") user.longPollingError = errors.New("not connected")
user.phoneResponding = true
} }
func (user *User) HasSession() bool { func (user *User) HasSession() bool {