Fix statekey usage in syncapi/stream_pdu

This commit is contained in:
Devon Hudson 2023-06-07 18:51:10 -06:00
parent a7113dc8a6
commit 12375bb026
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628

View file

@ -605,13 +605,17 @@ func (p *PDUStreamProvider) lazyLoadMembers(
// If this is a gapped incremental sync, we still want this membership // If this is a gapped incremental sync, we still want this membership
isGappedIncremental := limited && incremental isGappedIncremental := limited && incremental
// We want this users membership event, keep it in the list // We want this users membership event, keep it in the list
stateKey := *event.StateKey() userID := ""
if _, ok := timelineUsers[stateKey]; ok || isGappedIncremental || stateKey == device.UserID { stateKeyUserID, err := p.rsAPI.QueryUserIDForSender(ctx, roomID, spec.SenderID(*event.StateKey()))
if err == nil && stateKeyUserID != nil {
userID = stateKeyUserID.String()
}
if _, ok := timelineUsers[userID]; ok || isGappedIncremental || userID == device.UserID {
newStateEvents = append(newStateEvents, event) newStateEvents = append(newStateEvents, event)
if !stateFilter.IncludeRedundantMembers { if !stateFilter.IncludeRedundantMembers {
p.lazyLoadCache.StoreLazyLoadedUser(device, roomID, stateKey, event.EventID()) p.lazyLoadCache.StoreLazyLoadedUser(device, roomID, userID, event.EventID())
} }
delete(timelineUsers, stateKey) delete(timelineUsers, userID)
} }
} else { } else {
newStateEvents = append(newStateEvents, event) newStateEvents = append(newStateEvents, event)