mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Don't leak anything for left rooms until history vis works
This commit is contained in:
parent
e114744dcb
commit
6dd18094b7
1 changed files with 18 additions and 10 deletions
|
@ -305,6 +305,7 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync(
|
||||||
return jr, nil
|
return jr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:unparam
|
||||||
func (p *PDUStreamProvider) getLeaveResponseForCompleteSync(
|
func (p *PDUStreamProvider) getLeaveResponseForCompleteSync(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
roomID string,
|
roomID string,
|
||||||
|
@ -313,18 +314,20 @@ func (p *PDUStreamProvider) getLeaveResponseForCompleteSync(
|
||||||
eventFilter *gomatrixserverlib.RoomEventFilter,
|
eventFilter *gomatrixserverlib.RoomEventFilter,
|
||||||
device *userapi.Device,
|
device *userapi.Device,
|
||||||
) (lr *types.LeaveResponse, err error) {
|
) (lr *types.LeaveResponse, err error) {
|
||||||
recentEvents, stateEvents, prevBatch, limited, err := p.getResponseForCompleteSync(
|
/*
|
||||||
ctx, roomID, r, stateFilter, eventFilter, device,
|
recentEvents, stateEvents, prevBatch, limited, err := p.getResponseForCompleteSync(
|
||||||
)
|
ctx, roomID, r, stateFilter, eventFilter, device,
|
||||||
if err != nil {
|
)
|
||||||
return nil, fmt.Errorf("p.getResponseForCompleteSync: %w", err)
|
if err != nil {
|
||||||
}
|
return nil, fmt.Errorf("p.getResponseForCompleteSync: %w", err)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
lr = types.NewLeaveResponse()
|
lr = types.NewLeaveResponse()
|
||||||
lr.Timeline.PrevBatch = prevBatch
|
//lr.Timeline.PrevBatch = prevBatch
|
||||||
lr.Timeline.Events = gomatrixserverlib.HeaderedToClientEvents(recentEvents, gomatrixserverlib.FormatSync)
|
//lr.Timeline.Events = gomatrixserverlib.HeaderedToClientEvents(recentEvents, gomatrixserverlib.FormatSync)
|
||||||
lr.Timeline.Limited = limited
|
//lr.Timeline.Limited = limited
|
||||||
lr.State.Events = gomatrixserverlib.HeaderedToClientEvents(stateEvents, gomatrixserverlib.FormatSync)
|
//lr.State.Events = gomatrixserverlib.HeaderedToClientEvents(stateEvents, gomatrixserverlib.FormatSync)
|
||||||
return lr, nil
|
return lr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +401,11 @@ func (p *PDUStreamProvider) filterStreamEventsAccordingToHistoryVisibility(
|
||||||
return recentStreamEvents[sliceStart:sliceEnd], limited
|
return recentStreamEvents[sliceStart:sliceEnd], limited
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removeDuplicates takes a set of state events and timeline events and
|
||||||
|
// builds up a new set of state events. The returned state set will
|
||||||
|
// exclude any state events that appear in the timeline, so that the
|
||||||
|
// returned sync response doesn't duplicate them across both the state
|
||||||
|
// and timeline keys.
|
||||||
func removeDuplicates(stateEvents, recentEvents []*gomatrixserverlib.HeaderedEvent) []*gomatrixserverlib.HeaderedEvent {
|
func removeDuplicates(stateEvents, recentEvents []*gomatrixserverlib.HeaderedEvent) []*gomatrixserverlib.HeaderedEvent {
|
||||||
timeline := map[string]struct{}{}
|
timeline := map[string]struct{}{}
|
||||||
for _, event := range recentEvents {
|
for _, event := range recentEvents {
|
||||||
|
|
Loading…
Reference in a new issue