From 0d511c623b6a4fa12bef0e7cb0d65a197fd07637 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 30 Jul 2021 17:26:29 +0100 Subject: [PATCH] Fixes --- keyserver/internal/device_list_update.go | 7 ------- keyserver/internal/internal.go | 5 +++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/keyserver/internal/device_list_update.go b/keyserver/internal/device_list_update.go index 962d43aa..3d8c9748 100644 --- a/keyserver/internal/device_list_update.go +++ b/keyserver/internal/device_list_update.go @@ -391,9 +391,6 @@ func (u *DeviceListUpdater) updateDeviceList(res *gomatrixserverlib.RespUserDevi RespUserDeviceKeys: device.Keys, }, } - if device.DeviceID != "" { - keys[i].DeviceKeys.DeviceID = device.DeviceID - } if device.DisplayName != "" { keys[i].DeviceKeys.Unsigned = map[string]interface{}{ "device_display_name": device.DisplayName, @@ -412,10 +409,6 @@ func (u *DeviceListUpdater) updateDeviceList(res *gomatrixserverlib.RespUserDevi "failed to query device keys json for calculating diffs", ) } - - fmt.Println("EXISTING KEYS:", existingKeys[0].Unsigned) - fmt.Println("NEW KEYS:", keys[0].Unsigned) - err := u.db.StoreRemoteDeviceKeys(ctx, keys, []string{res.UserID}) if err != nil { return fmt.Errorf("failed to store remote device keys: %w", err) diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go index cb9af4c4..4dd93ef5 100644 --- a/keyserver/internal/internal.go +++ b/keyserver/internal/internal.go @@ -593,8 +593,9 @@ func appendDisplayNames(existing, new []api.DeviceMessage) []api.DeviceMessage { if existingDevice.DeviceID != newDevice.DeviceID { continue } - existingDevice.Unsigned["device_display_name"] = newDevice.DisplayName() - existing[i] = existingDevice + existing[i].Unsigned = map[string]interface{}{ + "device_display_name": newDevice.DisplayName(), + } } } return existing