Finish implementing retiring invites (#1166)

* Pass retired invites to the syncapi with the event ID of the invite

* Implement retire invite streaming

* Update whitelist
This commit is contained in:
Kegsay 2020-06-26 11:07:52 +01:00 committed by GitHub
parent c1d2382e6d
commit 4897beabee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 204 additions and 81 deletions

View file

@ -180,11 +180,8 @@ func (d *Database) AddInviteEvent(
// Returns an error if there was a problem communicating with the database.
func (d *Database) RetireInviteEvent(
ctx context.Context, inviteEventID string,
) error {
// TODO: Record that invite has been retired in a stream so that we can
// notify the user in an incremental sync.
err := d.Invites.DeleteInviteEvent(ctx, inviteEventID)
return err
) (types.StreamPosition, error) {
return d.Invites.DeleteInviteEvent(ctx, inviteEventID)
}
// GetAccountDataInRange returns all account data for a given user inserted or
@ -724,7 +721,7 @@ func (d *Database) addInvitesToResponse(
r types.Range,
res *types.Response,
) error {
invites, err := d.Invites.SelectInviteEventsInRange(
invites, retiredInvites, err := d.Invites.SelectInviteEventsInRange(
ctx, txn, userID, r,
)
if err != nil {
@ -734,6 +731,10 @@ func (d *Database) addInvitesToResponse(
ir := types.NewInviteResponse(inviteEvent)
res.Rooms.Invite[roomID] = *ir
}
for roomID := range retiredInvites {
lr := types.NewLeaveResponse()
res.Rooms.Leave[roomID] = *lr
}
return nil
}