Only return non-retired invites (#2643)
* Only return non-retired invites
* Revert "Only return non-retired invites"
This reverts commit 1150aa7f38
.
* Check if we're doing an initial sync in the stream
This commit is contained in:
parent
bcdbd5c00a
commit
0642ffc0f6
|
@ -7,8 +7,9 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/syncapi/types"
|
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/syncapi/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InviteStreamProvider struct {
|
type InviteStreamProvider struct {
|
||||||
|
@ -62,6 +63,11 @@ func (p *InviteStreamProvider) IncrementalSync(
|
||||||
req.Response.Rooms.Invite[roomID] = *ir
|
req.Response.Rooms.Invite[roomID] = *ir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When doing an initial sync, we don't want to add retired invites, as this
|
||||||
|
// can add rooms we were invited to, but already left.
|
||||||
|
if from == 0 {
|
||||||
|
return to
|
||||||
|
}
|
||||||
for roomID := range retiredInvites {
|
for roomID := range retiredInvites {
|
||||||
if _, ok := req.Response.Rooms.Join[roomID]; !ok {
|
if _, ok := req.Response.Rooms.Join[roomID]; !ok {
|
||||||
lr := types.NewLeaveResponse()
|
lr := types.NewLeaveResponse()
|
||||||
|
|
Loading…
Reference in a new issue