refactor: use is_unmessagable flag (#1965)

This commit is contained in:
James Rich 2025-05-28 12:32:08 -05:00 committed by GitHub
parent dcae34a786
commit 0a91464cfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,11 +105,13 @@ fun NodeItem(
val (detailsShown, showDetails) = remember { mutableStateOf(expanded) }
val unmessageable = remember(thatNode) {
val firmwareVersion = DeviceVersion(thatNode.metadata?.firmwareVersion ?: "")
if (firmwareVersion >= DeviceVersion("2.6.8")) {
thatNode.user.isUnmessagable
} else {
thatNode.user.role?.isUnmessageableRole() == true
when {
thatNode.user.hasIsUnmessagable() -> thatNode.user.isUnmessagable
thatNode.user.role.isUnmessageableRole() ->
thatNode.metadata?.firmwareVersion?.let {
DeviceVersion(it) < DeviceVersion("2.6.8")
} ?: true
else -> false
}
}