Compare commits
3 Commits
a8cfdaf287
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a5ad5973b7 | |||
| 01b1434e37 | |||
| 7a60460973 |
@@ -115,17 +115,31 @@ pub struct RoomIdInPath {
|
||||
pub(crate) room_id: OwnedRoomId,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct SingleRoomQuery {
|
||||
#[serde(default)]
|
||||
pub with_latest_event: bool,
|
||||
}
|
||||
|
||||
/// Get the list of joined rooms of the user
|
||||
pub async fn single_room_info(
|
||||
client: MatrixClientExtractor,
|
||||
path: web::Path<RoomIdInPath>,
|
||||
query: web::Query<SingleRoomQuery>,
|
||||
) -> HttpResult {
|
||||
let notifs = client.client.client.notification_settings().await;
|
||||
|
||||
Ok(match client.client.client.get_room(&path.room_id) {
|
||||
None => HttpResponse::NotFound().json("Room not found"),
|
||||
Some(r) => HttpResponse::Ok().json(APIRoomInfo::from_room(&r, ¬ifs).await?),
|
||||
})
|
||||
let Some(room) = client.client.client.get_room(&path.room_id) else {
|
||||
return Ok(HttpResponse::NotFound().json("Room not found"));
|
||||
};
|
||||
|
||||
let mut room_info = APIRoomInfo::from_room(&room, ¬ifs).await?;
|
||||
|
||||
if !query.with_latest_event {
|
||||
room_info.latest_event = None;
|
||||
}
|
||||
|
||||
Ok(HttpResponse::Ok().json(room_info))
|
||||
}
|
||||
|
||||
/// Get room avatar
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"eslint": "^9.39.3",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"globals": "^17.4.0",
|
||||
|
||||
Reference in New Issue
Block a user