Populate syncapi state event prev_sender with userID (#3142)

This commit is contained in:
devonh 2023-07-06 23:54:35 +00:00 committed by GitHub
parent 3a125fd8fa
commit cc9b695c1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -591,10 +591,16 @@ func (s *OutputRoomEventConsumer) updateStateEvent(event *rstypes.HeaderedEvent)
return event, nil return event, nil
} }
prevEventSender := string(prevEvent.SenderID())
prevUser, err := s.rsAPI.QueryUserIDForSender(s.ctx, *validRoomID, prevEvent.SenderID())
if err == nil && prevUser != nil {
prevEventSender = prevUser.String()
}
prev := types.PrevEventRef{ prev := types.PrevEventRef{
PrevContent: prevEvent.Content(), PrevContent: prevEvent.Content(),
ReplacesState: prevEvent.EventID(), ReplacesState: prevEvent.EventID(),
PrevSenderID: string(prevEvent.SenderID()), PrevSenderID: prevEventSender,
} }
event.PDU, err = event.SetUnsigned(prev) event.PDU, err = event.SetUnsigned(prev)