diff --git a/src/service/rooms/state_cache/data.rs b/src/service/rooms/state_cache/data.rs index 71a2c034..1124b457 100644 --- a/src/service/rooms/state_cache/data.rs +++ b/src/service/rooms/state_cache/data.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; use itertools::Itertools; use ruma::{ - events::{room::member::MembershipState, AnyStrippedStateEvent, AnySyncStateEvent}, + events::{AnyStrippedStateEvent, AnySyncStateEvent}, serde::Raw, OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId, }; @@ -50,17 +50,10 @@ pub trait Data: Send + Sync { /// in the room, even if they're deactivated/guests fn local_users_in_room<'a>(&'a self, room_id: &RoomId) -> Box + 'a>; - /// Returns an iterator of all our local users in a room who are active (not - /// deactivated, not guest) + /// Returns an iterator of all our local joined users in a room who are + /// active (not deactivated, not guest) fn active_local_users_in_room<'a>(&'a self, room_id: &RoomId) -> Box + 'a>; - /// 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 - fn active_local_joined_users_in_room<'a>( - &'a self, room_id: &'a RoomId, - ) -> Box + 'a>; - fn room_joined_count(&self, room_id: &RoomId) -> Result>; fn room_invited_count(&self, room_id: &RoomId) -> Result>; @@ -412,8 +405,8 @@ impl Data for KeyValueDatabase { ) } - /// Returns an iterator of all our local users in a room who are active (not - /// deactivated, not guest) + /// Returns an iterator of all our local joined users in a room who are + /// active (not deactivated, not guest) #[tracing::instrument(skip(self))] fn active_local_users_in_room<'a>(&'a self, room_id: &RoomId) -> Box + 'a> { Box::new( @@ -422,23 +415,6 @@ impl Data for KeyValueDatabase { ) } - /// 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 - #[tracing::instrument(skip(self))] - fn active_local_joined_users_in_room<'a>( - &'a self, room_id: &'a RoomId, - ) -> Box + 'a> { - Box::new(self.active_local_users_in_room(room_id).filter(|user_id| { - services() - .rooms - .state_accessor - .get_member(room_id, user_id) - .unwrap_or(None) - .map_or(false, |membership| membership.membership == MembershipState::Join) - })) - } - /// Returns the number of users which are currently in a room #[tracing::instrument(skip(self))] fn room_joined_count(&self, room_id: &RoomId) -> Result> { diff --git a/src/service/rooms/state_cache/mod.rs b/src/service/rooms/state_cache/mod.rs index 8f21a352..4fdfa3c0 100644 --- a/src/service/rooms/state_cache/mod.rs +++ b/src/service/rooms/state_cache/mod.rs @@ -281,22 +281,12 @@ impl Service { } #[tracing::instrument(skip(self))] - /// Returns an iterator of all our local users in a room who are active (not - /// deactivated, not guest) + /// Returns an iterator of all our local joined 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 + '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 + '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> { self.db.room_invited_count(room_id) } diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index b8462b87..affe35ab 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -310,7 +310,7 @@ impl Service { let mut push_target = services() .rooms .state_cache - .active_local_joined_users_in_room(&pdu.room_id) + .active_local_users_in_room(&pdu.room_id) .collect_vec(); if pdu.kind == TimelineEventType::RoomMember {