mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-26 15:08:28 +00:00
Fix peeks
This commit is contained in:
parent
3eaea0c411
commit
0769412df5
2 changed files with 20 additions and 28 deletions
|
@ -27,7 +27,8 @@ func (d *Database) PDUCompleteSync(
|
|||
defer sqlutil.EndTransactionWithCheck(txn, &succeeded, &err)
|
||||
|
||||
for _, roomID := range joinedRoomIDs {
|
||||
jr, err := d.getJoinResponseForCompleteSync(
|
||||
var jr *types.JoinResponse
|
||||
jr, err = d.getJoinResponseForCompleteSync(
|
||||
ctx, txn, roomID, r, stateFilter, eventFilter, req.WantFullState, req.Device,
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -38,6 +39,24 @@ func (d *Database) PDUCompleteSync(
|
|||
req.Rooms[roomID] = gomatrixserverlib.Join
|
||||
}
|
||||
|
||||
peeks, err := d.Peeks.SelectPeeksInRange(ctx, txn, req.Device.UserID, req.Device.ID, r)
|
||||
if err != nil {
|
||||
return fmt.Errorf("d.Peeks.SelectPeeksInRange: %w", err)
|
||||
}
|
||||
|
||||
for _, peek := range peeks {
|
||||
if !peek.Deleted {
|
||||
var jr *types.JoinResponse
|
||||
jr, err = d.getJoinResponseForCompleteSync(
|
||||
ctx, txn, peek.RoomID, r, stateFilter, eventFilter, req.WantFullState, req.Device,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("d.getJoinResponseForCompleteSync: %w", err)
|
||||
}
|
||||
req.Response.Rooms.Peek[peek.RoomID] = *jr
|
||||
}
|
||||
}
|
||||
|
||||
succeeded = true
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -47,15 +47,6 @@ func (p *PDUStreamProvider) CompleteSync(
|
|||
return from
|
||||
}
|
||||
|
||||
// Add peeked rooms.
|
||||
/*
|
||||
peeks, err := p.DB.PeeksInRange(ctx, req.Device.UserID, req.Device.ID, r)
|
||||
if err != nil {
|
||||
req.Log.WithError(err).Error("p.DB.PeeksInRange failed")
|
||||
return from
|
||||
}
|
||||
*/
|
||||
|
||||
stateFilter := req.Filter.Room.State
|
||||
eventFilter := req.Filter.Room.Timeline
|
||||
|
||||
|
@ -64,24 +55,6 @@ func (p *PDUStreamProvider) CompleteSync(
|
|||
return from
|
||||
}
|
||||
|
||||
/*
|
||||
for _, peek := range peeks {
|
||||
p.queue(func() {
|
||||
if !peek.Deleted {
|
||||
var jr *types.JoinResponse
|
||||
jr, err = p.getJoinResponseForCompleteSync(
|
||||
ctx, peek.RoomID, r, &stateFilter, &eventFilter, req.WantFullState, req.Device,
|
||||
)
|
||||
if err != nil {
|
||||
req.Log.WithError(err).Error("p.getJoinResponseForCompleteSync failed")
|
||||
return
|
||||
}
|
||||
req.Response.Rooms.Peek[peek.RoomID] = *jr
|
||||
}
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue