mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
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:
parent
c1d2382e6d
commit
4897beabee
16 changed files with 204 additions and 81 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue