From e09a44831b0bafc8b225627f85d0a34f443b291b Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 16 Jun 2023 12:43:12 +0200 Subject: [PATCH] feat(ui): Implement `RoomList::invites`. --- crates/matrix-sdk-ui/src/room_list/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/matrix-sdk-ui/src/room_list/mod.rs b/crates/matrix-sdk-ui/src/room_list/mod.rs index 483df7fd7..d4b214c71 100644 --- a/crates/matrix-sdk-ui/src/room_list/mod.rs +++ b/crates/matrix-sdk-ui/src/room_list/mod.rs @@ -230,6 +230,19 @@ impl RoomList { .ok_or_else(|| Error::UnknownList(ALL_ROOMS_LIST_NAME.to_owned())) } + /// Get all previous invites, in addition to a [`Stream`] to invites. + /// + /// Invites are taking the form of `RoomListEntry`, it's like a “sub” room + /// list. + pub async fn invites( + &self, + ) -> Result<(Vector, impl Stream>), Error> { + self.sliding_sync + .on_list(INVITES_LIST_NAME, |list| ready(list.room_list_stream())) + .await + .ok_or_else(|| Error::UnknownList(INVITES_LIST_NAME.to_owned())) + } + /// Pass an [`Input`] onto the state machine. pub async fn apply_input(&self, input: Input) -> Result<(), Error> { use Input::*;