mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Review comments
This commit is contained in:
parent
4de37c51f9
commit
03f62871ef
@ -33,7 +33,7 @@ func upClearStuckInvites(ctx context.Context, tx *sql.Tx) error {
|
||||
WHERE room_id NOT IN (
|
||||
SELECT room_id
|
||||
FROM syncv3_rooms
|
||||
) GROUP BY user_id
|
||||
)
|
||||
`)
|
||||
defer rows.Close()
|
||||
if err != nil {
|
||||
|
@ -209,4 +209,24 @@ func TestClearStuckInvites(t *testing.T) {
|
||||
t.Fatalf("SelectAllInvitesForUser got invites for %s, wanted none: %+v", userID, got)
|
||||
}
|
||||
}
|
||||
// ensure other invites remain
|
||||
wantInvites := map[string][]string{
|
||||
alice: {roomA},
|
||||
charlie: {roomC},
|
||||
}
|
||||
for userID, wantInvitesRooms := range wantInvites {
|
||||
got, err := inviteTable.SelectAllInvitesForUser(userID)
|
||||
if err != nil {
|
||||
t.Fatalf("SelectAllInvitesForUser: %s", err)
|
||||
}
|
||||
if len(got) != len(wantInvitesRooms) {
|
||||
t.Fatalf("SelectAllInvitesForUser got %d invites for %s, wanted %d", len(got), userID, len(wantInvitesRooms))
|
||||
}
|
||||
for _, wantRoom := range wantInvitesRooms {
|
||||
_, exists := got[wantRoom]
|
||||
if !exists {
|
||||
t.Fatalf("SelectAllInvitesForUser wanted invite for %s in %s, but it's missing", userID, wantRoom)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user