move and improve common-rooms related

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-11-20 20:21:31 +00:00
parent aea82183b2
commit 3968d03868
6 changed files with 21 additions and 38 deletions

View file

@ -52,8 +52,8 @@ pub(crate) async fn get_presence_route(
let has_shared_rooms = services
.rooms
.user
.has_shared_rooms(sender_user, &body.user_id)
.state_cache
.user_sees_user(sender_user, &body.user_id)
.await;
if has_shared_rooms {

View file

@ -52,7 +52,7 @@ async fn share_encrypted_room(
) -> bool {
services
.rooms
.user
.state_cache
.get_shared_rooms(sender_user, user_id)
.ready_filter(|&room_id| Some(room_id) != ignore_room)
.any(|other_room_id| {

View file

@ -55,7 +55,7 @@ pub(crate) async fn get_mutual_rooms_route(
let mutual_rooms: Vec<OwnedRoomId> = services
.rooms
.user
.state_cache
.get_shared_rooms(sender_user, &body.user_id)
.map(ToOwned::to_owned)
.collect()

View file

@ -71,8 +71,8 @@ pub(crate) async fn search_users_route(
} else {
let user_is_in_shared_rooms = services
.rooms
.user
.has_shared_rooms(sender_user, &user.user_id)
.state_cache
.user_sees_user(sender_user, &user.user_id)
.await;
if user_is_in_shared_rooms {