rooms: Override the joined_members() method so we return the correct RoomMember
parent
2a5ede9e1a
commit
a7c2a645aa
|
@ -182,11 +182,21 @@ impl Common {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get active members for this room, includes invited, joined members.
|
async fn ensure_members(&self) -> Result<()> {
|
||||||
pub async fn active_members(&self) -> Result<Vec<RoomMember>> {
|
|
||||||
if !self.are_members_synced() {
|
if !self.are_members_synced() {
|
||||||
self.request_members().await?;
|
self.request_members().await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get active members for this room, includes invited, joined members.
|
||||||
|
///
|
||||||
|
/// *Note*: This method will fetch the members from the homeserver if the
|
||||||
|
/// member list isn't synchronized due to member lazy loading.
|
||||||
|
pub async fn active_members(&self) -> Result<Vec<RoomMember>> {
|
||||||
|
self.ensure_members().await?;
|
||||||
|
|
||||||
Ok(self
|
Ok(self
|
||||||
.inner
|
.inner
|
||||||
.active_members()
|
.active_members()
|
||||||
|
@ -196,11 +206,29 @@ impl Common {
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get all the joined members of this room.
|
||||||
|
///
|
||||||
|
/// *Note*: This method will fetch the members from the homeserver if the
|
||||||
|
/// member list isn't synchronized due to member lazy loading.
|
||||||
|
pub async fn joined_members(&self) -> Result<Vec<RoomMember>> {
|
||||||
|
self.ensure_members().await?;
|
||||||
|
|
||||||
|
Ok(self
|
||||||
|
.inner
|
||||||
|
.members()
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.map(|member| RoomMember::new(self.client.clone(), member))
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
/// Get all members for this room, includes invited, joined and left members.
|
/// Get all members for this room, includes invited, joined and left members.
|
||||||
|
///
|
||||||
|
/// *Note*: This method will fetch the members from the homeserver if the
|
||||||
|
/// member list isn't synchronized due to member lazy loading.
|
||||||
pub async fn members(&self) -> Result<Vec<RoomMember>> {
|
pub async fn members(&self) -> Result<Vec<RoomMember>> {
|
||||||
if !self.are_members_synced() {
|
self.ensure_members().await?;
|
||||||
self.request_members().await?;
|
|
||||||
}
|
|
||||||
Ok(self
|
Ok(self
|
||||||
.inner
|
.inner
|
||||||
.members()
|
.members()
|
||||||
|
|
Loading…
Reference in New Issue