mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-04 05:58:11 -04:00
Add invited and joined counts
This commit is contained in:
committed by
Damir Jelić
parent
43b28e6087
commit
7ac6ebfb7f
@@ -456,6 +456,14 @@ impl Room {
|
||||
self.room.active_members_count()
|
||||
}
|
||||
|
||||
pub fn invited_members_count(&self) -> u64 {
|
||||
self.room.invited_members_count()
|
||||
}
|
||||
|
||||
pub fn joined_members_count(&self) -> u64 {
|
||||
self.room.joined_members_count()
|
||||
}
|
||||
|
||||
/// Reports an event from the room.
|
||||
///
|
||||
/// # Arguments
|
||||
|
||||
@@ -358,6 +358,16 @@ impl Room {
|
||||
self.inner.read().unwrap().active_members_count()
|
||||
}
|
||||
|
||||
/// Returns the number of members who have been invited to the room.
|
||||
pub fn invited_members_count(&self) -> u64 {
|
||||
self.inner.read().unwrap().invited_members_count()
|
||||
}
|
||||
|
||||
/// Returns the number of members who have joined the room.
|
||||
pub fn joined_members_count(&self) -> u64 {
|
||||
self.inner.read().unwrap().joined_members_count()
|
||||
}
|
||||
|
||||
async fn calculate_name(&self) -> StoreResult<DisplayName> {
|
||||
let summary = {
|
||||
let inner = self.inner.read().unwrap();
|
||||
@@ -750,6 +760,16 @@ impl RoomInfo {
|
||||
self.summary.joined_member_count.saturating_add(self.summary.invited_member_count)
|
||||
}
|
||||
|
||||
/// The number of invited members in the room
|
||||
pub fn invited_members_count(&self) -> u64 {
|
||||
self.summary.invited_member_count
|
||||
}
|
||||
|
||||
/// The number of joined members in the room
|
||||
pub fn joined_members_count(&self) -> u64 {
|
||||
self.summary.joined_member_count
|
||||
}
|
||||
|
||||
/// Get the canonical alias of this room.
|
||||
pub fn canonical_alias(&self) -> Option<&RoomAliasId> {
|
||||
self.base_info.canonical_alias.as_ref()?.as_original()?.content.alias.as_deref()
|
||||
|
||||
@@ -437,12 +437,6 @@ impl Common {
|
||||
self.members_no_sync(RoomMemberships::ACTIVE).await
|
||||
}
|
||||
|
||||
/// Returns the number of members who have joined or been invited to the
|
||||
/// room.
|
||||
pub fn active_members_count(&self) -> u64 {
|
||||
self.inner.active_members_count()
|
||||
}
|
||||
|
||||
/// Get active members for this room, includes invited, joined members.
|
||||
///
|
||||
/// *Note*: This method will not fetch the members from the homeserver if
|
||||
|
||||
Reference in New Issue
Block a user