Get device names from unsigned in /user/devices

This commit is contained in:
Neil Alexander 2022-04-29 13:44:44 +01:00
parent d28d0ee66e
commit 0364c6232c
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -20,6 +20,7 @@ import (
keyapi "github.com/matrix-org/dendrite/keyserver/api"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
"github.com/tidwall/gjson"
)
// GetUserDevices for the given user id
@ -69,9 +70,14 @@ func GetUserDevices(
continue
}
displayName := dev.DisplayName
if dev.DisplayName == "" {
displayName = gjson.GetBytes(dev.DeviceKeys.KeyJSON, "unsigned.device_display_name").Str
}
device := gomatrixserverlib.RespUserDevice{
DeviceID: dev.DeviceID,
DisplayName: dev.DisplayName,
DisplayName: displayName,
Keys: key,
}