Update ruma to latest, renamed server keys and removed PduStub
This commit is contained in:
parent
b869aab5d0
commit
164b1633d8
19 changed files with 123 additions and 87 deletions
|
@ -492,6 +492,7 @@ pub async fn register_route(
|
|||
body: "Thanks for trying out Conduit! This software is still in development, so expect many bugs and missing features. If you have federation enabled, you can join the Conduit chat room by typing <code>/join #conduit:matrix.org</code>. <strong>Important: Please don't join any other Matrix rooms over federation without permission from the room's admins.</strong> Some actions might trigger bugs in other server implementations, breaking the chat for everyone else.".to_owned(),
|
||||
}),
|
||||
relates_to: None,
|
||||
new_content: None,
|
||||
},
|
||||
))
|
||||
.expect("event is valid, we just created it"),
|
||||
|
|
|
@ -6,7 +6,7 @@ use ruma::{
|
|||
r0::config::{get_global_account_data, set_global_account_data},
|
||||
},
|
||||
events::{custom::CustomEventContent, BasicEvent},
|
||||
Raw,
|
||||
serde::Raw,
|
||||
};
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
|
|
|
@ -20,7 +20,8 @@ use ruma::{
|
|||
room::{avatar, canonical_alias, guest_access, history_visibility, name, topic},
|
||||
EventType,
|
||||
},
|
||||
Raw, ServerName,
|
||||
serde::Raw,
|
||||
ServerName,
|
||||
};
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
|
@ -83,7 +84,13 @@ pub async fn set_room_visibility_route(
|
|||
) -> ConduitResult<set_room_visibility::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
match body.visibility {
|
||||
match &body.visibility {
|
||||
room::Visibility::_Custom(_s) => {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::InvalidParam,
|
||||
"Room visibility type is not supported.",
|
||||
));
|
||||
}
|
||||
room::Visibility::Public => {
|
||||
db.rooms.set_public(&body.room_id, true)?;
|
||||
info!("{} made {} public", sender_user, body.room_id);
|
||||
|
@ -294,7 +301,9 @@ pub async fn get_public_rooms_filtered_helper(
|
|||
.url,
|
||||
)
|
||||
})
|
||||
.transpose()?,
|
||||
.transpose()?
|
||||
// url is now an Option<String> so we must flatten
|
||||
.flatten(),
|
||||
};
|
||||
Ok(chunk)
|
||||
})
|
||||
|
|
|
@ -18,8 +18,8 @@ use ruma::{
|
|||
federation,
|
||||
},
|
||||
events::{pdu::Pdu, room::member, EventType},
|
||||
serde::{to_canonical_value, CanonicalJsonObject},
|
||||
EventId, Raw, RoomId, RoomVersionId, ServerName, UserId,
|
||||
serde::{to_canonical_value, CanonicalJsonObject, Raw},
|
||||
EventId, RoomId, RoomVersionId, ServerName, UserId,
|
||||
};
|
||||
use state_res::StateEvent;
|
||||
use std::{
|
||||
|
@ -541,7 +541,7 @@ async fn join_room_by_id_helper(
|
|||
federation::membership::create_join_event::v2::Request {
|
||||
room_id,
|
||||
event_id: &event_id,
|
||||
pdu_stub: PduEvent::convert_to_outgoing_federation_event(join_event.clone()),
|
||||
pdu: PduEvent::convert_to_outgoing_federation_event(join_event.clone()),
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
|
|
@ -32,7 +32,7 @@ pub async fn set_presence_route(
|
|||
.try_into()
|
||||
.expect("time is valid"),
|
||||
),
|
||||
presence: body.presence,
|
||||
presence: body.presence.clone(),
|
||||
status_msg: body.status_msg.clone(),
|
||||
},
|
||||
sender: sender_user.clone(),
|
||||
|
|
|
@ -8,7 +8,7 @@ use ruma::{
|
|||
},
|
||||
},
|
||||
events::EventType,
|
||||
Raw,
|
||||
serde::Raw,
|
||||
};
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
|
|
|
@ -10,7 +10,8 @@ use ruma::{
|
|||
room::{guest_access, history_visibility, join_rules, member, name, topic},
|
||||
EventType,
|
||||
},
|
||||
Raw, RoomAliasId, RoomId, RoomVersionId,
|
||||
serde::Raw,
|
||||
RoomAliasId, RoomId, RoomVersionId,
|
||||
};
|
||||
use std::{cmp::max, collections::BTreeMap, convert::TryFrom};
|
||||
|
||||
|
@ -141,10 +142,14 @@ pub async fn create_room_route(
|
|||
// 4. Events set by preset
|
||||
|
||||
// Figure out preset. We need it for preset specific events
|
||||
let preset = body.preset.unwrap_or_else(|| match body.visibility {
|
||||
room::Visibility::Private => create_room::RoomPreset::PrivateChat,
|
||||
room::Visibility::Public => create_room::RoomPreset::PublicChat,
|
||||
});
|
||||
let preset = body
|
||||
.preset
|
||||
.clone()
|
||||
.unwrap_or_else(|| match &body.visibility {
|
||||
room::Visibility::Private => create_room::RoomPreset::PrivateChat,
|
||||
room::Visibility::Public => create_room::RoomPreset::PublicChat,
|
||||
room::Visibility::_Custom(s) => create_room::RoomPreset::_Custom(s.into()),
|
||||
});
|
||||
|
||||
// 4.1 Join Rules
|
||||
db.rooms.build_and_append_pdu(
|
||||
|
|
|
@ -3,7 +3,8 @@ use crate::{ConduitResult, Database, Error, Ruma};
|
|||
use ruma::{
|
||||
api::client::r0::sync::sync_events,
|
||||
events::{room::member::MembershipState, AnySyncEphemeralRoomEvent, EventType},
|
||||
Raw, RoomId, UserId,
|
||||
serde::Raw,
|
||||
RoomId, UserId,
|
||||
};
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue