Move sendAsServer

This commit is contained in:
Till Faelligen 2023-11-23 19:37:23 +01:00
parent 8bbd9406f8
commit 06064e0b48
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -77,7 +77,6 @@ func (r *Inputer) updateLatestEvents(
roomInfo: roomInfo, roomInfo: roomInfo,
stateAtEvent: stateAtEvent, stateAtEvent: stateAtEvent,
event: event, event: event,
sendAsServer: sendAsServer,
rewritesState: rewritesState, rewritesState: rewritesState,
historyVisibility: historyVisibility, historyVisibility: historyVisibility,
} }
@ -88,7 +87,7 @@ func (r *Inputer) updateLatestEvents(
return fmt.Errorf("u.doUpdateLatestEvents: %w", err) return fmt.Errorf("u.doUpdateLatestEvents: %w", err)
} }
update, err := u.makeOutputNewRoomEvent(transactionID) update, err := u.makeOutputNewRoomEvent(transactionID, sendAsServer)
if err != nil { if err != nil {
return fmt.Errorf("u.makeOutputNewRoomEvent: %w", err) return fmt.Errorf("u.makeOutputNewRoomEvent: %w", err)
} }
@ -128,8 +127,6 @@ type latestEventsUpdater struct {
stateAtEvent types.StateAtEvent stateAtEvent types.StateAtEvent
event gomatrixserverlib.PDU event gomatrixserverlib.PDU
rewritesState bool rewritesState bool
// Which server to send this event as.
sendAsServer string
// The eventID of the event that was processed before this one. // The eventID of the event that was processed before this one.
lastEventIDSent string lastEventIDSent string
// The latest events in the room after processing this event. // The latest events in the room after processing this event.
@ -388,7 +385,7 @@ func (u *latestEventsUpdater) calculateLatest(
return true, nil 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)) latestEventIDs := make([]string, len(u.latest))
for i := range u.latest { for i := range u.latest {
latestEventIDs[i] = u.latest[i].EventID latestEventIDs[i] = u.latest[i].EventID
@ -400,7 +397,7 @@ func (u *latestEventsUpdater) makeOutputNewRoomEvent(transactionID *api.Transact
LastSentEventID: u.lastEventIDSent, LastSentEventID: u.lastEventIDSent,
LatestEventIDs: latestEventIDs, LatestEventIDs: latestEventIDs,
TransactionID: transactionID, TransactionID: transactionID,
SendAsServer: u.sendAsServer, SendAsServer: sendAsServer,
HistoryVisibility: u.historyVisibility, HistoryVisibility: u.historyVisibility,
} }