From e0633a5b6d77c201da91031fefd6d4e643229050 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Tue, 22 Feb 2022 11:01:29 +0100 Subject: [PATCH] Send device_list update to satisfy sytest --- keyserver/internal/device_list_update.go | 4 ++-- keyserver/internal/internal.go | 8 ++++++-- sytest-whitelist | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/keyserver/internal/device_list_update.go b/keyserver/internal/device_list_update.go index c5a5d40c7..d85dbd7d4 100644 --- a/keyserver/internal/device_list_update.go +++ b/keyserver/internal/device_list_update.go @@ -224,7 +224,7 @@ func (u *DeviceListUpdater) update(ctx context.Context, event gomatrixserverlib. }).Info("DeviceListUpdater.Update") // if we haven't missed anything update the database and notify users - if exists { + if exists || event.Deleted { k := event.Keys if event.Deleted { k = nil @@ -454,7 +454,7 @@ func (u *DeviceListUpdater) updateDeviceList(res *gomatrixserverlib.RespUserDevi if err != nil { return fmt.Errorf("failed to mark device list as fresh: %w", err) } - err = emitDeviceKeyChanges(u.producer, existingKeys, keys) + err = emitDeviceKeyChanges(u.producer, existingKeys, keys, false) if err != nil { return fmt.Errorf("failed to emit key changes for fresh device list: %w", err) } diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go index 0c264b718..b337cae4c 100644 --- a/keyserver/internal/internal.go +++ b/keyserver/internal/internal.go @@ -648,7 +648,7 @@ func (a *KeyInternalAPI) uploadLocalDeviceKeys(ctx context.Context, req *api.Per } return } - err = emitDeviceKeyChanges(a.Producer, existingKeys, keysToStore) + err = emitDeviceKeyChanges(a.Producer, existingKeys, keysToStore, req.OnlyDisplayNameUpdates) if err != nil { util.GetLogger(ctx).Errorf("Failed to emitDeviceKeyChanges: %s", err) } @@ -710,7 +710,11 @@ func (a *KeyInternalAPI) uploadOneTimeKeys(ctx context.Context, req *api.Perform } -func emitDeviceKeyChanges(producer KeyChangeProducer, existing, new []api.DeviceMessage) error { +func emitDeviceKeyChanges(producer KeyChangeProducer, existing, new []api.DeviceMessage, onlyUpdateDisplayName bool) error { + // if we only want to update the display names, we can skip the checks below + if onlyUpdateDisplayName { + return producer.ProduceKeyChanges(new) + } // find keys in new that are not in existing var keysAdded []api.DeviceMessage for _, newKey := range new { diff --git a/sytest-whitelist b/sytest-whitelist index 187a0f475..cd4d79a7f 100644 --- a/sytest-whitelist +++ b/sytest-whitelist @@ -596,4 +596,7 @@ Device list doesn't change if remote server is down /context/ on joined room works /context/ on non world readable room does not work /context/ returns correct number of events -/context/ with lazy_load_members filter works \ No newline at end of file +/context/ with lazy_load_members filter works +Can query remote device keys using POST after notification +Device deletion propagates over federation +Get left notifs in sync and /keys/changes when other user leaves