Rename user rooms iterations which have state vectors as values.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -123,13 +123,13 @@ impl Service {
|
||||
let rooms_invited = self
|
||||
.services
|
||||
.state_cache
|
||||
.rooms_invited(user_id)
|
||||
.rooms_invited_state(user_id)
|
||||
.map(|(r, _)| r);
|
||||
|
||||
let rooms_knocked = self
|
||||
.services
|
||||
.state_cache
|
||||
.rooms_knocked(user_id)
|
||||
.rooms_knocked_state(user_id)
|
||||
.map(|(r, _)| r);
|
||||
|
||||
let all_rooms: Vec<_> = rooms_joined
|
||||
|
||||
@@ -399,7 +399,7 @@ pub fn rooms_joined<'a>(
|
||||
/// Returns an iterator over all rooms a user was invited to.
|
||||
#[implement(Service)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn rooms_invited<'a>(
|
||||
pub fn rooms_invited_state<'a>(
|
||||
&'a self,
|
||||
user_id: &'a UserId,
|
||||
) -> impl Stream<Item = StrippedStateEventItem> + Send + 'a {
|
||||
@@ -419,7 +419,7 @@ pub fn rooms_invited<'a>(
|
||||
/// Returns an iterator over all rooms a user is currently knocking.
|
||||
#[implement(Service)]
|
||||
#[tracing::instrument(skip(self), level = "trace")]
|
||||
pub fn rooms_knocked<'a>(
|
||||
pub fn rooms_knocked_state<'a>(
|
||||
&'a self,
|
||||
user_id: &'a UserId,
|
||||
) -> impl Stream<Item = StrippedStateEventItem> + Send + 'a {
|
||||
@@ -436,6 +436,26 @@ pub fn rooms_knocked<'a>(
|
||||
.ignore_err()
|
||||
}
|
||||
|
||||
/// Returns an iterator over all rooms a user left.
|
||||
#[implement(Service)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn rooms_left_state<'a>(
|
||||
&'a self,
|
||||
user_id: &'a UserId,
|
||||
) -> impl Stream<Item = SyncStateEventItem> + Send + 'a {
|
||||
type KeyVal<'a> = (Key<'a>, Raw<Vec<Raw<AnySyncStateEvent>>>);
|
||||
type Key<'a> = (&'a UserId, &'a RoomId);
|
||||
|
||||
let prefix = (user_id, Interfix);
|
||||
self.db
|
||||
.userroomid_leftstate
|
||||
.stream_prefix(&prefix)
|
||||
.ignore_err()
|
||||
.map(|((_, room_id), state): KeyVal<'_>| (room_id.to_owned(), state))
|
||||
.map(|(room_id, state)| Ok((room_id, state.deserialize_as_unchecked()?)))
|
||||
.ignore_err()
|
||||
}
|
||||
|
||||
#[implement(Service)]
|
||||
#[tracing::instrument(skip(self), level = "trace")]
|
||||
pub async fn invite_state(
|
||||
@@ -490,26 +510,6 @@ pub async fn left_state(
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns an iterator over all rooms a user left.
|
||||
#[implement(Service)]
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
pub fn rooms_left<'a>(
|
||||
&'a self,
|
||||
user_id: &'a UserId,
|
||||
) -> impl Stream<Item = SyncStateEventItem> + Send + 'a {
|
||||
type KeyVal<'a> = (Key<'a>, Raw<Vec<Raw<AnySyncStateEvent>>>);
|
||||
type Key<'a> = (&'a UserId, &'a RoomId);
|
||||
|
||||
let prefix = (user_id, Interfix);
|
||||
self.db
|
||||
.userroomid_leftstate
|
||||
.stream_prefix(&prefix)
|
||||
.ignore_err()
|
||||
.map(|((_, room_id), state): KeyVal<'_>| (room_id.to_owned(), state))
|
||||
.map(|(room_id, state)| Ok((room_id, state.deserialize_as_unchecked()?)))
|
||||
.ignore_err()
|
||||
}
|
||||
|
||||
#[implement(Service)]
|
||||
#[tracing::instrument(skip(self), level = "trace")]
|
||||
pub async fn user_membership(
|
||||
|
||||
Reference in New Issue
Block a user