base: Add a method to get either the display name or the localpart of an user
parent
0c81f3d9ae
commit
b995492457
|
@ -47,6 +47,14 @@ impl RoomMember {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &str {
|
||||
if let Some(d) = self.display_name() {
|
||||
d
|
||||
} else {
|
||||
self.user_id().localpart()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn normalized_power_level(&self) -> i64 {
|
||||
if self.max_power_level > 0 {
|
||||
(self.power_level() * 100) / self.max_power_level
|
||||
|
|
Loading…
Reference in New Issue