From d092d3c8109bdd57ee926dfa0d93af7160a40dc0 Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Thu, 6 Jul 2023 17:04:39 -0600 Subject: [PATCH] Populate syncapi state event prev_sender with userID --- 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 7ba3afc4b3..8c83e6885c 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)