Make allow_encryption work again, fixing #115

This commit is contained in:
Nyaaori 2021-09-24 22:44:26 +00:00
parent 47f3263396
commit 9082a531c9
No known key found for this signature in database
GPG key ID: 50C66D0980648414
2 changed files with 16 additions and 0 deletions

View file

@ -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