From 06064e0b48eb369c815bcc9f10e0019f28138bd7 Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:37:23 +0100 Subject: [PATCH] Move sendAsServer --- roomserver/internal/input/input_latest_events.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index 6f3c98c72..4db3bfc08 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -77,7 +77,6 @@ func (r *Inputer) updateLatestEvents( roomInfo: roomInfo, stateAtEvent: stateAtEvent, event: event, - sendAsServer: sendAsServer, rewritesState: rewritesState, historyVisibility: historyVisibility, } @@ -88,7 +87,7 @@ func (r *Inputer) updateLatestEvents( return fmt.Errorf("u.doUpdateLatestEvents: %w", err) } - update, err := u.makeOutputNewRoomEvent(transactionID) + update, err := u.makeOutputNewRoomEvent(transactionID, sendAsServer) if err != nil { return fmt.Errorf("u.makeOutputNewRoomEvent: %w", err) } @@ -128,8 +127,6 @@ type latestEventsUpdater struct { stateAtEvent types.StateAtEvent event gomatrixserverlib.PDU rewritesState bool - // Which server to send this event as. - sendAsServer string // The eventID of the event that was processed before this one. lastEventIDSent string // The latest events in the room after processing this event. @@ -388,7 +385,7 @@ func (u *latestEventsUpdater) calculateLatest( return true, nil } -func (u *latestEventsUpdater) makeOutputNewRoomEvent(transactionID *api.TransactionID) (*api.OutputEvent, error) { +func (u *latestEventsUpdater) makeOutputNewRoomEvent(transactionID *api.TransactionID, sendAsServer string) (*api.OutputEvent, error) { latestEventIDs := make([]string, len(u.latest)) for i := range u.latest { latestEventIDs[i] = u.latest[i].EventID @@ -400,7 +397,7 @@ func (u *latestEventsUpdater) makeOutputNewRoomEvent(transactionID *api.Transact LastSentEventID: u.lastEventIDSent, LatestEventIDs: latestEventIDs, TransactionID: transactionID, - SendAsServer: u.sendAsServer, + SendAsServer: sendAsServer, HistoryVisibility: u.historyVisibility, }