diff --git a/modules/api/src/main/java/net/pantasystem/milktea/api/misskey/users/UserDTO.kt b/modules/api/src/main/java/net/pantasystem/milktea/api/misskey/users/UserDTO.kt index 7b2c1cb67d..c4dbdaf522 100644 --- a/modules/api/src/main/java/net/pantasystem/milktea/api/misskey/users/UserDTO.kt +++ b/modules/api/src/main/java/net/pantasystem/milktea/api/misskey/users/UserDTO.kt @@ -173,6 +173,6 @@ data class UserDTO( val iconUrl: String?, @SerialName("displayOrder") - val displayOrder: Int, + val displayOrder: Int? = null, ) } diff --git a/modules/data/src/main/java/net/pantasystem/milktea/data/converters/UserDTOEntityConverter.kt b/modules/data/src/main/java/net/pantasystem/milktea/data/converters/UserDTOEntityConverter.kt index 5c4e442d95..0dee1775d2 100644 --- a/modules/data/src/main/java/net/pantasystem/milktea/data/converters/UserDTOEntityConverter.kt +++ b/modules/data/src/main/java/net/pantasystem/milktea/data/converters/UserDTOEntityConverter.kt @@ -60,11 +60,11 @@ class UserDTOEntityConverter @Inject constructor( it.name to it.host to it.url to it.uri } - val badgeRoles = userDTO.badgeRoles?.map { role -> + val badgeRoles = userDTO.badgeRoles?.mapIndexed { index, role -> User.BadgeRole( name = role.name, iconUri = role.iconUrl, - displayOrder = role.displayOrder + displayOrder = role.displayOrder ?: ((userDTO.badgeRoles?.size ?: 0) - index) ) }?.sortedByDescending { it.displayOrder