abstract+add more "users in room" accessors, check membership state on active_local_joined_users_in_room
`roomuserid_joined` cf seems unreliable, so in the mean time we need to check membership state (or maybe this is a more reliable check anyways) Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
c738c119f8
commit
0857fe7907
3 changed files with 76 additions and 17 deletions
|
@ -274,12 +274,29 @@ impl Service {
|
|||
pub fn room_joined_count(&self, room_id: &RoomId) -> Result<Option<u64>> { self.db.room_joined_count(room_id) }
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
/// Returns a vec of all the users joined in a room who are active
|
||||
/// (not guests, not deactivated users)
|
||||
pub fn active_local_users_in_room(&self, room_id: &RoomId) -> Vec<OwnedUserId> {
|
||||
/// Returns an iterator of all our local users in the room, even if they're
|
||||
/// deactivated/guests
|
||||
pub fn local_users_in_room<'a>(&'a self, room_id: &RoomId) -> impl Iterator<Item = OwnedUserId> + 'a {
|
||||
self.db.local_users_in_room(room_id)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
/// Returns an iterator of all our local users in a room who are active (not
|
||||
/// deactivated, not guest)
|
||||
pub fn active_local_users_in_room<'a>(&'a self, room_id: &RoomId) -> impl Iterator<Item = OwnedUserId> + 'a {
|
||||
self.db.active_local_users_in_room(room_id)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
/// Returns an iterator of all our local users joined in a room who are
|
||||
/// active (not deactivated, not guest) and have a joined membership state
|
||||
/// in the room
|
||||
pub fn active_local_joined_users_in_room<'a>(
|
||||
&'a self, room_id: &'a RoomId,
|
||||
) -> impl Iterator<Item = OwnedUserId> + 'a {
|
||||
self.db.active_local_joined_users_in_room(room_id)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn room_invited_count(&self, room_id: &RoomId) -> Result<Option<u64>> { self.db.room_invited_count(room_id) }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue