mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-04 02:53:40 +00:00
Cancel peeks on join again
This commit is contained in:
parent
2b8f0b8f59
commit
56d772fafc
1 changed files with 12 additions and 0 deletions
|
@ -1129,8 +1129,10 @@ func (d *Database) getStateDeltasForFullStateSync(
|
|||
}
|
||||
|
||||
// Add full states for all peeking rooms
|
||||
peeking := make(map[string]bool)
|
||||
newPeeks := false
|
||||
for _, peek := range peeks {
|
||||
peeking[peek.RoomID] = true
|
||||
if peek.New {
|
||||
newPeeks = true
|
||||
}
|
||||
|
@ -1192,6 +1194,16 @@ func (d *Database) getStateDeltasForFullStateSync(
|
|||
if stateErr != nil {
|
||||
return nil, nil, stateErr
|
||||
}
|
||||
if peeking[joinedRoomID] {
|
||||
// we automatically cancel our peeks when we join a room
|
||||
if err = d.Writer.Do(d.DB, txn, func(txn *sql.Tx) error {
|
||||
// XXX: is it correct that we're discarding the streamid here?
|
||||
_, err = d.Peeks.DeletePeeks(ctx, txn, joinedRoomID, userID)
|
||||
return err
|
||||
}); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
}
|
||||
deltas[joinedRoomID] = stateDelta{
|
||||
membership: gomatrixserverlib.Join,
|
||||
stateEvents: d.StreamEventsToEvents(device, s),
|
||||
|
|
Loading…
Reference in a new issue