From aadbc14dc6624ab414eda8d66deda1eacf65c429 Mon Sep 17 00:00:00 2001 From: Amanda Graven Date: Fri, 15 Jan 2021 18:44:32 +0100 Subject: [PATCH] Add accessor for room member avatar urls --- matrix_sdk_base/src/rooms/members.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/matrix_sdk_base/src/rooms/members.rs b/matrix_sdk_base/src/rooms/members.rs index 2d517411..e17d6ad6 100644 --- a/matrix_sdk_base/src/rooms/members.rs +++ b/matrix_sdk_base/src/rooms/members.rs @@ -56,6 +56,13 @@ impl RoomMember { } } + pub fn avatar_url(&self) -> Option<&str> { + match self.profile.as_ref() { + Some(p) => p.avatar_url.as_deref(), + None => self.event.content.avatar_url.as_deref(), + } + } + pub fn normalized_power_level(&self) -> i64 { if self.max_power_level > 0 { (self.power_level() * 100) / self.max_power_level