mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Fix invites maybe
This commit is contained in:
parent
cf8f637ae0
commit
4222175cb9
|
|
@ -275,14 +275,14 @@ func (s *OutputRoomEventConsumer) onNewInviteEvent(
|
||||||
}).Panicf("roomserver output log: write invite failure")
|
}).Panicf("roomserver output log: write invite failure")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
s.notifier.OnNewInvite(types.StreamingToken{PDUPosition: pduPos}, *msg.Event.StateKey())
|
s.notifier.OnNewInvite(types.StreamingToken{InvitePosition: pduPos}, *msg.Event.StateKey())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OutputRoomEventConsumer) onRetireInviteEvent(
|
func (s *OutputRoomEventConsumer) onRetireInviteEvent(
|
||||||
ctx context.Context, msg api.OutputRetireInviteEvent,
|
ctx context.Context, msg api.OutputRetireInviteEvent,
|
||||||
) error {
|
) error {
|
||||||
sp, err := s.db.RetireInviteEvent(ctx, msg.EventID)
|
pduPos, err := s.db.RetireInviteEvent(ctx, msg.EventID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// panic rather than continue with an inconsistent database
|
// panic rather than continue with an inconsistent database
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
|
|
@ -293,7 +293,7 @@ func (s *OutputRoomEventConsumer) onRetireInviteEvent(
|
||||||
}
|
}
|
||||||
// Notify any active sync requests that the invite has been retired.
|
// Notify any active sync requests that the invite has been retired.
|
||||||
// Invites share the same stream counter as PDUs
|
// Invites share the same stream counter as PDUs
|
||||||
s.notifier.OnNewEvent(nil, "", []string{msg.TargetUserID}, types.StreamingToken{PDUPosition: sp})
|
s.notifier.OnNewInvite(types.StreamingToken{InvitePosition: pduPos}, msg.TargetUserID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -503,7 +503,6 @@ func (d *Database) addPDUDeltaToResponse(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
device userapi.Device,
|
device userapi.Device,
|
||||||
r types.Range,
|
r types.Range,
|
||||||
ir types.Range,
|
|
||||||
numRecentEventsPerRoom int,
|
numRecentEventsPerRoom int,
|
||||||
wantFullState bool,
|
wantFullState bool,
|
||||||
res *types.Response,
|
res *types.Response,
|
||||||
|
|
@ -545,11 +544,6 @@ func (d *Database) addPDUDeltaToResponse(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This should be done in getStateDeltas
|
|
||||||
if err = d.addInvitesToResponse(ctx, txn, device.UserID, ir, res); err != nil {
|
|
||||||
return nil, fmt.Errorf("d.addInvitesToResponse: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
succeeded = true
|
succeeded = true
|
||||||
return joinedRoomIDs, nil
|
return joinedRoomIDs, nil
|
||||||
}
|
}
|
||||||
|
|
@ -704,12 +698,8 @@ func (d *Database) IncrementalSync(
|
||||||
From: fromPos.PDUPosition,
|
From: fromPos.PDUPosition,
|
||||||
To: toPos.PDUPosition,
|
To: toPos.PDUPosition,
|
||||||
}
|
}
|
||||||
ir := types.Range{
|
|
||||||
From: fromPos.InvitePosition,
|
|
||||||
To: toPos.InvitePosition,
|
|
||||||
}
|
|
||||||
joinedRoomIDs, err = d.addPDUDeltaToResponse(
|
joinedRoomIDs, err = d.addPDUDeltaToResponse(
|
||||||
ctx, device, r, ir, numRecentEventsPerRoom, wantFullState, res,
|
ctx, device, r, numRecentEventsPerRoom, wantFullState, res,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("d.addPDUDeltaToResponse: %w", err)
|
return nil, fmt.Errorf("d.addPDUDeltaToResponse: %w", err)
|
||||||
|
|
@ -732,6 +722,14 @@ func (d *Database) IncrementalSync(
|
||||||
return nil, fmt.Errorf("d.addEDUDeltaToResponse: %w", err)
|
return nil, fmt.Errorf("d.addEDUDeltaToResponse: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ir := types.Range{
|
||||||
|
From: fromPos.InvitePosition,
|
||||||
|
To: toPos.InvitePosition,
|
||||||
|
}
|
||||||
|
if err = d.addInvitesToResponse(ctx, nil, device.UserID, ir, res); err != nil {
|
||||||
|
return nil, fmt.Errorf("d.addInvitesToResponse: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue