Add is_direct() alternative query for m.room.member.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -28,7 +28,7 @@ use ruma::{
|
|||||||
room::RoomType,
|
room::RoomType,
|
||||||
};
|
};
|
||||||
use tuwunel_core::{
|
use tuwunel_core::{
|
||||||
Result, err,
|
Result, err, is_true,
|
||||||
matrix::{Pdu, room_version, state_res::events::RoomCreateEvent},
|
matrix::{Pdu, room_version, state_res::events::RoomCreateEvent},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -82,6 +82,14 @@ impl Service {
|
|||||||
.await
|
.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(
|
pub async fn get_member(
|
||||||
&self,
|
&self,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
|
|||||||
Reference in New Issue
Block a user