mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Device list display name fixes (#2405)
* Get device names from `unsigned` in `/user/devices` * Fix display name updates * Fix bug * Fix another bug
This commit is contained in:
parent
d28d0ee66e
commit
31799a3b2a
2 changed files with 54 additions and 49 deletions
|
@ -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 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,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue