2 Commits

Author SHA1 Message Date
d387d6ed9f chore(deps): update rust crate ipnet to 2.12.0
Some checks failed
continuous-integration/drone/push Build is failing
2026-03-11 00:17:58 +00:00
a5ad5973b7 feat: do not return latest_event info when getting single room information by default
Some checks failed
continuous-integration/drone/push Build is failing
2026-03-10 18:14:49 +01:00
3 changed files with 21 additions and 7 deletions

View File

@@ -2823,9 +2823,9 @@ dependencies = [
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.11.0" version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
dependencies = [ dependencies = [
"serde", "serde",
] ]

View File

@@ -23,7 +23,7 @@ futures-util = "0.3.32"
jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] } jwt-simple = { version = "0.12.14", default-features = false, features = ["pure-rust"] }
thiserror = "2.0.18" thiserror = "2.0.18"
uuid = { version = "1.21.0", features = ["v4", "serde"] } uuid = { version = "1.21.0", features = ["v4", "serde"] }
ipnet = { version = "2.11.0", features = ["serde"] } ipnet = { version = "2.12.0", features = ["serde"] }
rand = "0.10.0" rand = "0.10.0"
hex = "0.4.3" hex = "0.4.3"
mailchecker = "6.0.19" mailchecker = "6.0.19"

View File

@@ -115,17 +115,31 @@ pub struct RoomIdInPath {
pub(crate) room_id: OwnedRoomId, 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 /// Get the list of joined rooms of the user
pub async fn single_room_info( pub async fn single_room_info(
client: MatrixClientExtractor, client: MatrixClientExtractor,
path: web::Path<RoomIdInPath>, path: web::Path<RoomIdInPath>,
query: web::Query<SingleRoomQuery>,
) -> HttpResult { ) -> HttpResult {
let notifs = client.client.client.notification_settings().await; let notifs = client.client.client.notification_settings().await;
Ok(match client.client.client.get_room(&path.room_id) { let Some(room) = client.client.client.get_room(&path.room_id) else {
None => HttpResponse::NotFound().json("Room not found"), return Ok(HttpResponse::NotFound().json("Room not found"));
Some(r) => HttpResponse::Ok().json(APIRoomInfo::from_room(&r, &notifs).await?), };
})
let mut room_info = APIRoomInfo::from_room(&room, &notifs).await?;
if !query.with_latest_event {
room_info.latest_event = None;
}
Ok(HttpResponse::Ok().json(room_info))
} }
/// Get room avatar /// Get room avatar