mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-03 12:13:09 -06:00
Get device names from unsigned in /user/devices
This commit is contained in:
parent
d28d0ee66e
commit
0364c6232c
|
|
@ -20,6 +20,7 @@ import (
|
||||||
keyapi "github.com/matrix-org/dendrite/keyserver/api"
|
keyapi "github.com/matrix-org/dendrite/keyserver/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetUserDevices for the given user id
|
// GetUserDevices for the given user id
|
||||||
|
|
@ -69,9 +70,14 @@ func GetUserDevices(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayName := dev.DisplayName
|
||||||
|
if dev.DisplayName == "" {
|
||||||
|
displayName = gjson.GetBytes(dev.DeviceKeys.KeyJSON, "unsigned.device_display_name").Str
|
||||||
|
}
|
||||||
|
|
||||||
device := gomatrixserverlib.RespUserDevice{
|
device := gomatrixserverlib.RespUserDevice{
|
||||||
DeviceID: dev.DeviceID,
|
DeviceID: dev.DeviceID,
|
||||||
DisplayName: dev.DisplayName,
|
DisplayName: displayName,
|
||||||
Keys: key,
|
Keys: key,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue