From cc9b695c1ed22e47b723032793d4cf087c0f3ecc Mon Sep 17 00:00:00 2001 From: devonh Date: Thu, 6 Jul 2023 23:54:35 +0000 Subject: [PATCH] Populate syncapi state event prev_sender with userID (#3142) --- syncapi/consumers/roomserver.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go index 7ba3afc4b..8c83e6885 100644 --- a/syncapi/consumers/roomserver.go +++ b/syncapi/consumers/roomserver.go @@ -591,10 +591,16 @@ func (s *OutputRoomEventConsumer) updateStateEvent(event *rstypes.HeaderedEvent) 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{ PrevContent: prevEvent.Content(), ReplacesState: prevEvent.EventID(), - PrevSenderID: string(prevEvent.SenderID()), + PrevSenderID: prevEventSender, } event.PDU, err = event.SetUnsigned(prev)