wip
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m25s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m13s
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m25s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m13s
This commit is contained in:
@@ -309,27 +309,21 @@ impl ChatRegistry {
|
||||
.map(|this| this.downgrade())
|
||||
}
|
||||
|
||||
/// Get all rooms.
|
||||
pub fn rooms(&self, _cx: &App) -> &Vec<Entity<Room>> {
|
||||
&self.rooms
|
||||
}
|
||||
|
||||
/// Get all ongoing rooms.
|
||||
pub fn ongoing_rooms(&self, cx: &App) -> Vec<Entity<Room>> {
|
||||
/// Get all rooms based on the filter.
|
||||
pub fn rooms(&self, filter: &RoomKind, cx: &App) -> Vec<Entity<Room>> {
|
||||
self.rooms
|
||||
.iter()
|
||||
.filter(|room| room.read(cx).kind == RoomKind::Ongoing)
|
||||
.filter(|room| &room.read(cx).kind == filter)
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Get all request rooms.
|
||||
pub fn request_rooms(&self, cx: &App) -> Vec<Entity<Room>> {
|
||||
/// Count the number of rooms based on the filter.
|
||||
pub fn count(&self, filter: &RoomKind, cx: &App) -> usize {
|
||||
self.rooms
|
||||
.iter()
|
||||
.filter(|room| room.read(cx).kind != RoomKind::Ongoing)
|
||||
.cloned()
|
||||
.collect()
|
||||
.filter(|room| &room.read(cx).kind == filter)
|
||||
.count()
|
||||
}
|
||||
|
||||
/// Add a new room to the start of list.
|
||||
|
||||
Reference in New Issue
Block a user