base: Don't mark all the room methods as public.

master
Damir Jelić 2021-01-04 12:26:13 +01:00
parent 83b850d8f9
commit 4afc6b2567
2 changed files with 8 additions and 12 deletions

View File

@ -2899,7 +2899,7 @@ mod test {
let room = client
.get_joined_room(&room_id!("!SVkFJHzfwvuaIEawgC:localhost"))
.unwrap();
let members: Vec<RoomMember> = room.get_active_members().await.collect().await;
let members: Vec<RoomMember> = room.active_members().await.collect().await;
assert_eq!(1, members.len());
// assert!(room.power_levels.is_some())

View File

@ -63,7 +63,7 @@ pub enum RoomType {
}
impl Room {
pub fn new(
pub(crate) fn new(
own_user_id: &UserId,
store: SledStore,
room_id: &RoomId,
@ -84,7 +84,7 @@ impl Room {
Self::restore(own_user_id, store, room_info)
}
pub fn restore(own_user_id: &UserId, store: SledStore, room_info: RoomInfo) -> Self {
pub(crate) fn restore(own_user_id: &UserId, store: SledStore, room_info: RoomInfo) -> Self {
Self {
own_user_id: Arc::new(own_user_id.clone()),
room_id: room_info.room_id.clone(),
@ -165,17 +165,17 @@ impl Room {
self.calculate_name().await
}
pub async fn get_joined_user_ids(&self) -> impl Stream<Item = UserId> {
pub async fn joined_user_ids(&self) -> impl Stream<Item = UserId> {
self.store.get_joined_user_ids(self.room_id()).await
}
pub async fn get_joined_members(&self) -> impl Stream<Item = RoomMember> + '_ {
pub async fn joined_members(&self) -> impl Stream<Item = RoomMember> + '_ {
let joined = self.store.get_joined_user_ids(self.room_id()).await;
joined.filter_map(move |u| async move { self.get_member(&u).await })
}
pub async fn get_active_members(&self) -> impl Stream<Item = RoomMember> + '_ {
pub async fn active_members(&self) -> impl Stream<Item = RoomMember> + '_ {
let joined = self.store.get_joined_user_ids(self.room_id()).await;
let invited = self.store.get_invited_user_ids(self.room_id()).await;
@ -235,7 +235,7 @@ impl Room {
names.sort();
names.join(", ")
} else if heroes_count >= invited_joined {
let members = self.get_active_members().await;
let members = self.active_members().await;
let mut names = members
.filter(|m| future::ready(is_own_member(m)))
@ -251,7 +251,7 @@ impl Room {
names.sort();
names.join(", ")
} else if heroes_count < invited_joined && invited + joined > 1 {
let members = self.get_active_members().await;
let members = self.active_members().await;
let mut names = members
.filter(|m| future::ready(is_own_member(m)))
@ -278,10 +278,6 @@ impl Room {
(*self.inner.read().unwrap()).clone()
}
pub async fn joined_user_ids(&self) -> impl Stream<Item = UserId> {
self.store.get_joined_user_ids(&self.room_id).await
}
pub fn update_summary(&self, summary: RoomInfo) {
let mut inner = self.inner.write().unwrap();
*inner = summary;