Fix 'Invited user can reject invite over federation several times' (#1341)

This commit is contained in:
Kegsay 2020-08-25 18:59:00 +01:00 committed by GitHub
parent c60270eea3
commit 55498c8deb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View file

@ -139,6 +139,14 @@ func (s *inviteEventsStatements) SelectInviteEventsInRange(
return nil, nil, err
}
// if we have seen this room before, it has a higher stream position and hence takes priority
// because the query is ORDER BY id DESC so drop them
_, isRetired := retired[roomID]
_, isInvited := result[roomID]
if isRetired || isInvited {
continue
}
var event gomatrixserverlib.HeaderedEvent
if err := json.Unmarshal(eventJSON, &event); err != nil {
return nil, nil, err