diff --git a/src/client_server.rs b/src/client_server.rs
index 26095678..f4a34b21 100644
--- a/src/client_server.rs
+++ b/src/client_server.rs
@@ -34,7 +34,7 @@ use ruma::{
media::{create_content, get_content, get_content_thumbnail, get_media_config},
membership::{
ban_user, forget_room, get_member_events, invite_user, join_room_by_id,
- join_room_by_id_or_alias, kick_user, leave_room, unban_user,
+ join_room_by_id_or_alias, joined_rooms, kick_user, leave_room, unban_user,
},
message::{create_message_event, get_message_events},
presence::set_presence,
@@ -1439,6 +1439,23 @@ pub fn create_room_route(
Ok(create_room::Response { room_id }.into())
}
+#[get("/_matrix/client/r0/joined_rooms", data = "
")]
+pub fn joined_rooms_route(
+ db: State<'_, Database>,
+ body: Ruma,
+) -> ConduitResult {
+ let user_id = body.user_id.as_ref().expect("user is authenticated");
+
+ Ok(joined_rooms::Response {
+ joined_rooms: db
+ .rooms
+ .rooms_joined(&user_id)
+ .filter_map(|r| r.ok())
+ .collect(),
+ }
+ .into())
+}
+
#[put(
"/_matrix/client/r0/rooms/<_room_id>/redact/<_event_id>/<_txn_id>",
data = ""
diff --git a/src/main.rs b/src/main.rs
index 1815aec7..ef2b7cc1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -66,6 +66,7 @@ fn setup_rocket() -> rocket::Rocket {
client_server::join_room_by_id_or_alias_route,
client_server::leave_room_route,
client_server::forget_room_route,
+ client_server::joined_rooms_route,
client_server::kick_user_route,
client_server::ban_user_route,
client_server::unban_user_route,
diff --git a/src/ruma_wrapper.rs b/src/ruma_wrapper.rs
index e3dc5ae2..48f54872 100644
--- a/src/ruma_wrapper.rs
+++ b/src/ruma_wrapper.rs
@@ -1,7 +1,7 @@
use crate::{utils, Error};
use log::warn;
use rocket::{
- data::{Data, FromDataFuture, Transform, TransformFuture, Transformed, FromTransformedData},
+ data::{Data, FromDataFuture, FromTransformedData, Transform, TransformFuture, Transformed},
http::Status,
response::{self, Responder},
Outcome::*,
@@ -125,7 +125,7 @@ impl<'r, 'o, T> Responder<'r, 'o> for RumaResponse
where
T: Send + TryInto>>,
T::Error: Send,
- 'o: 'r
+ 'o: 'r,
{
fn respond_to(self, _: &'r Request<'_>) -> response::Result<'o> {
let http_response: Result, _> = self.0.try_into();
@@ -143,8 +143,7 @@ where
let http_body = http_response.into_body();
- response
- .sized_body(http_body.len(), Cursor::new(http_body));
+ response.sized_body(http_body.len(), Cursor::new(http_body));
response.raw_header("Access-Control-Allow-Origin", "*");
response.raw_header(
diff --git a/sytest/sytest-whitelist b/sytest/sytest-whitelist
index f29075c6..0d5ff7be 100644
--- a/sytest/sytest-whitelist
+++ b/sytest/sytest-whitelist
@@ -29,6 +29,8 @@ GET /publicRooms lists newly-created room
GET /register yields a set of flows
GET /rooms/:room_id/state fetches entire room state
GET /rooms/:room_id/state/m.room.member/:user_id fetches my membership
+GET /joined_rooms lists newly-created room
+/joined_rooms returns only joined rooms
Getting push rules doesn't corrupt the cache SYN-390
POST /createRoom makes a private room
POST /createRoom makes a private room with invites