mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-28 17:24:41 +01:00
Merge branch 'nyaaori/allow_encryption' into 'next'
Make allow_encryption work again, fixing #115 Closes #115 See merge request famedly/conduit!212
This commit is contained in:
commit
0ccda5f1c7
2 changed files with 16 additions and 0 deletions
|
@ -45,6 +45,14 @@ pub async fn send_message_event_route(
|
|||
);
|
||||
let state_lock = mutex_state.lock().await;
|
||||
|
||||
// Forbid m.room.encrypted if encryption is disabled
|
||||
if &body.event_type == "m.room.encrypted" && !db.globals.allow_encryption() {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
"Encryption has been disabled",
|
||||
));
|
||||
}
|
||||
|
||||
// Check if this is a new transaction id
|
||||
if let Some(response) =
|
||||
db.transaction_ids
|
||||
|
|
|
@ -73,6 +73,14 @@ pub async fn send_state_event_for_empty_key_route(
|
|||
) -> ConduitResult<send_state_event::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
// Forbid m.room.encryption if encryption is disabled
|
||||
if &body.event_type == "m.room.encryption" && !db.globals.allow_encryption() {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
"Encryption has been disabled",
|
||||
));
|
||||
}
|
||||
|
||||
let event_id = send_state_event_for_key_helper(
|
||||
&db,
|
||||
sender_user,
|
||||
|
|
Loading…
Reference in a new issue