Add is_direct() alternative query for m.room.member.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-10-07 17:21:35 +00:00
parent 51fc2342a4
commit 97e709492c

View File

@@ -28,7 +28,7 @@ use ruma::{
room::RoomType,
};
use tuwunel_core::{
Result, err,
Result, err, is_true,
matrix::{Pdu, room_version, state_res::events::RoomCreateEvent},
};
@@ -82,6 +82,14 @@ impl Service {
.await
}
pub async fn is_direct(&self, room_id: &RoomId, user_id: &UserId) -> bool {
self.get_member(room_id, user_id)
.await
.ok()
.and_then(|content| content.is_direct)
.is_some_and(is_true!())
}
pub async fn get_member(
&self,
room_id: &RoomId,