Fix getting prev content

This commit is contained in:
Till Faelligen 2023-06-29 11:35:15 +02:00
parent 2b3b355ebd
commit 302d8d7089
No known key found for this signature in database
GPG key ID: ACCDC9606D472758

View file

@ -558,13 +558,6 @@ func (s *OutputRoomEventConsumer) updateStateEvent(event *rstypes.HeaderedEvent)
var succeeded bool
defer sqlutil.EndTransactionWithCheck(snapshot, &succeeded, &err)
prevEvent, err := snapshot.GetStateEvent(
s.ctx, event.RoomID(), event.Type(), stateKey,
)
if err != nil {
return event, err
}
validRoomID, err := spec.NewRoomID(event.RoomID())
if err != nil {
return event, err
@ -577,10 +570,18 @@ func (s *OutputRoomEventConsumer) updateStateEvent(event *rstypes.HeaderedEvent)
if err == nil && sku != nil {
sKey := sku.String()
event.StateKeyResolved = &sKey
stateKey = sKey
}
}
}
prevEvent, err := snapshot.GetStateEvent(
s.ctx, event.RoomID(), event.Type(), stateKey,
)
if err != nil {
return event, err
}
userID, err := s.rsAPI.QueryUserIDForSender(s.ctx, *validRoomID, event.SenderID())
if err != nil {
return event, err