Move historyVisibility

This commit is contained in:
Till Faelligen 2023-11-23 19:48:53 +01:00
parent 7999ef09d5
commit 0f74cbfb27
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -77,7 +77,6 @@ func (r *Inputer) updateLatestEvents(
stateAtEvent: stateAtEvent,
event: event,
rewritesState: rewritesState,
historyVisibility: historyVisibility,
}
var updates []api.OutputEvent
@ -86,7 +85,7 @@ func (r *Inputer) updateLatestEvents(
return fmt.Errorf("u.doUpdateLatestEvents: %w", err)
}
update, err := u.makeOutputNewRoomEvent(transactionID, sendAsServer, updater.LastEventIDSent())
update, err := u.makeOutputNewRoomEvent(transactionID, sendAsServer, updater.LastEventIDSent(), historyVisibility)
if err != nil {
return fmt.Errorf("u.makeOutputNewRoomEvent: %w", err)
}
@ -139,8 +138,6 @@ type latestEventsUpdater struct {
// The snapshots of current state before and after processing this event
oldStateNID types.StateSnapshotNID
newStateNID types.StateSnapshotNID
// The history visibility of the event itself (from the state before the event).
historyVisibility gomatrixserverlib.HistoryVisibility
}
func (u *latestEventsUpdater) doUpdateLatestEvents(roomInfo *types.RoomInfo) ([]api.OutputEvent, error) {
@ -379,7 +376,12 @@ func (u *latestEventsUpdater) calculateLatest(
return true, nil
}
func (u *latestEventsUpdater) makeOutputNewRoomEvent(transactionID *api.TransactionID, sendAsServer string, lastEventIDSent string) (*api.OutputEvent, error) {
func (u *latestEventsUpdater) makeOutputNewRoomEvent(
transactionID *api.TransactionID,
sendAsServer string,
lastEventIDSent string,
historyVisibility gomatrixserverlib.HistoryVisibility,
) (*api.OutputEvent, error) {
latestEventIDs := make([]string, len(u.latest))
for i := range u.latest {
latestEventIDs[i] = u.latest[i].EventID
@ -392,7 +394,7 @@ func (u *latestEventsUpdater) makeOutputNewRoomEvent(transactionID *api.Transact
LatestEventIDs: latestEventIDs,
TransactionID: transactionID,
SendAsServer: sendAsServer,
HistoryVisibility: u.historyVisibility,
HistoryVisibility: historyVisibility,
}
eventIDMap, err := u.stateEventMap()