This commit is contained in:
Neil Alexander 2021-07-30 17:26:29 +01:00
parent 9d69340ef1
commit 0d511c623b
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 3 additions and 9 deletions

View file

@ -391,9 +391,6 @@ func (u *DeviceListUpdater) updateDeviceList(res *gomatrixserverlib.RespUserDevi
RespUserDeviceKeys: device.Keys, RespUserDeviceKeys: device.Keys,
}, },
} }
if device.DeviceID != "" {
keys[i].DeviceKeys.DeviceID = device.DeviceID
}
if device.DisplayName != "" { if device.DisplayName != "" {
keys[i].DeviceKeys.Unsigned = map[string]interface{}{ keys[i].DeviceKeys.Unsigned = map[string]interface{}{
"device_display_name": device.DisplayName, "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", "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}) err := u.db.StoreRemoteDeviceKeys(ctx, keys, []string{res.UserID})
if err != nil { if err != nil {
return fmt.Errorf("failed to store remote device keys: %w", err) return fmt.Errorf("failed to store remote device keys: %w", err)

View file

@ -593,8 +593,9 @@ func appendDisplayNames(existing, new []api.DeviceMessage) []api.DeviceMessage {
if existingDevice.DeviceID != newDevice.DeviceID { if existingDevice.DeviceID != newDevice.DeviceID {
continue continue
} }
existingDevice.Unsigned["device_display_name"] = newDevice.DisplayName() existing[i].Unsigned = map[string]interface{}{
existing[i] = existingDevice "device_display_name": newDevice.DisplayName(),
}
} }
} }
return existing return existing