fix: ruma
This commit is contained in:
parent
d07762f596
commit
0fcefa4125
8 changed files with 115 additions and 66 deletions
|
@ -9,7 +9,11 @@ use ruma::{
|
|||
r0::room::{self, create_room, get_room_event, upgrade_room},
|
||||
},
|
||||
events::{
|
||||
room::{guest_access, history_visibility, join_rules, member, name, topic},
|
||||
room::{
|
||||
guest_access, history_visibility, join_rules, member,
|
||||
name::{self, RoomName},
|
||||
topic,
|
||||
},
|
||||
EventType,
|
||||
},
|
||||
serde::Raw,
|
||||
|
@ -113,7 +117,7 @@ pub async fn create_room_route(
|
|||
.unwrap_or_else(|| match &body.visibility {
|
||||
room::Visibility::Private => create_room::RoomPreset::PrivateChat,
|
||||
room::Visibility::Public => create_room::RoomPreset::PublicChat,
|
||||
room::Visibility::_Custom(_) => create_room::RoomPreset::PrivateChat, // Room visibility should not be custom
|
||||
_ => create_room::RoomPreset::PrivateChat, // Room visibility should not be custom
|
||||
});
|
||||
|
||||
let mut users = BTreeMap::new();
|
||||
|
@ -251,11 +255,11 @@ pub async fn create_room_route(
|
|||
db.rooms.build_and_append_pdu(
|
||||
PduBuilder {
|
||||
event_type: EventType::RoomName,
|
||||
content: serde_json::to_value(
|
||||
name::NameEventContent::new(name.clone()).map_err(|_| {
|
||||
content: serde_json::to_value(name::NameEventContent::new(Some(
|
||||
RoomName::try_from(name.clone()).map_err(|_| {
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Name is invalid.")
|
||||
})?,
|
||||
)
|
||||
)))
|
||||
.expect("event is valid, we just created it"),
|
||||
unsigned: None,
|
||||
state_key: Some("".to_owned()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue