|
|
|
@ -12,6 +12,7 @@ use ruma::{
|
|
|
|
|
serde::Raw,
|
|
|
|
|
EventId, RoomId, UserId,
|
|
|
|
|
};
|
|
|
|
|
use tracing::log::warn;
|
|
|
|
|
|
|
|
|
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}`
|
|
|
|
|
///
|
|
|
|
@ -129,10 +130,13 @@ pub async fn get_state_events_for_key_route(
|
|
|
|
|
.rooms
|
|
|
|
|
.state_accessor
|
|
|
|
|
.room_state_get(&body.room_id, &body.event_type, &body.state_key)?
|
|
|
|
|
.ok_or(Error::BadRequest(
|
|
|
|
|
ErrorKind::NotFound,
|
|
|
|
|
"State event not found.",
|
|
|
|
|
))?;
|
|
|
|
|
.ok_or({
|
|
|
|
|
warn!(
|
|
|
|
|
"State event {:?} not found in room {:?}",
|
|
|
|
|
&body.event_type, &body.room_id
|
|
|
|
|
);
|
|
|
|
|
Error::BadRequest(ErrorKind::NotFound, "State event not found.")
|
|
|
|
|
})?;
|
|
|
|
|
|
|
|
|
|
Ok(get_state_events_for_key::v3::Response {
|
|
|
|
|
content: serde_json::from_str(event.content.get())
|
|
|
|
@ -165,10 +169,13 @@ pub async fn get_state_events_for_empty_key_route(
|
|
|
|
|
.rooms
|
|
|
|
|
.state_accessor
|
|
|
|
|
.room_state_get(&body.room_id, &body.event_type, "")?
|
|
|
|
|
.ok_or(Error::BadRequest(
|
|
|
|
|
ErrorKind::NotFound,
|
|
|
|
|
"State event not found.",
|
|
|
|
|
))?;
|
|
|
|
|
.ok_or({
|
|
|
|
|
warn!(
|
|
|
|
|
"State event {:?} not found in room {:?}",
|
|
|
|
|
&body.event_type, &body.room_id
|
|
|
|
|
);
|
|
|
|
|
Error::BadRequest(ErrorKind::NotFound, "State event not found.")
|
|
|
|
|
})?;
|
|
|
|
|
|
|
|
|
|
Ok(get_state_events_for_key::v3::Response {
|
|
|
|
|
content: serde_json::from_str(event.content.get())
|
|
|
|
|