diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-04-29 16:02:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 16:02:55 +0100 |
commit | 31799a3b2a733192a656cfa77662599bd1568bdc (patch) | |
tree | 35ed3a276ebfa4615ce7eae9060fd817bcaa2a8f /federationapi | |
parent | d28d0ee66e22402bebd791a46de33c8bf3169e26 (diff) |
Device list display name fixes (#2405)
* Get device names from `unsigned` in `/user/devices`
* Fix display name updates
* Fix bug
* Fix another bug
Diffstat (limited to 'federationapi')
-rw-r--r-- | federationapi/routing/devices.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/federationapi/routing/devices.go b/federationapi/routing/devices.go index 8890eac4..57286fa9 100644 --- a/federationapi/routing/devices.go +++ b/federationapi/routing/devices.go @@ -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, } |