This commit is contained in:
Neil Alexander 2020-05-28 17:53:40 +01:00
parent 5389a62952
commit f4376c4582
2 changed files with 6 additions and 2 deletions

View file

@ -279,6 +279,7 @@ func (t *txnReq) processEDUs(edus []gomatrixserverlib.EDU) {
}
for userID, byUser := range directPayload.Messages {
for deviceID, message := range byUser {
// TODO: check that the user and the device actually exist here
if err := t.eduProducer.SendToDevice(t.context, userID, deviceID, directPayload.EventType, message); err != nil {
util.GetLogger(t.context).WithError(err).Error("Failed to send send-to-device event to edu server")
}

View file

@ -539,7 +539,8 @@ func TestSendToDeviceBehaviour(t *testing.T) {
}
// At this point we should get exactly one message. We're sending the sync position
// that we were given from the update.
// that we were given from the update and the send-to-device update will be updated
// in the database to reflect that this was the sync position we sent the message at.
second, err := db.SendToDeviceUpdatesForSync(ctx, "alice", "one", types.NewStreamToken(0, streamPos))
if err != nil {
t.Fatal(err)
@ -560,7 +561,7 @@ func TestSendToDeviceBehaviour(t *testing.T) {
}
// At this point we should now have no updates, because we've progressed the sync
// position. Therefore the update from before will be cleane
// position. Therefore the update from before will not be sent again.
fourth, err := db.SendToDeviceUpdatesForSync(ctx, "alice", "one", types.NewStreamToken(0, streamPos+1))
if err != nil {
t.Fatal(err)
@ -569,6 +570,8 @@ func TestSendToDeviceBehaviour(t *testing.T) {
t.Fatal("fourth call should have no updates")
}
// At this point we should still have no updates, because no new updates have been
// sent.
fifth, err := db.SendToDeviceUpdatesForSync(ctx, "alice", "one", types.NewStreamToken(0, streamPos+2))
if err != nil {
t.Fatal(err)