refactor: Fix remaining errors in api/cient/message.rs

This commit is contained in:
Ginger
2026-04-12 11:58:59 -04:00
parent ca358438ee
commit 39b2e461be
4 changed files with 35 additions and 59 deletions
+5 -3
View File
@@ -27,7 +27,7 @@ use ruma::{
api::{
Direction,
client::{filter::RoomEventFilter, message::get_message_events},
error::ErrorKind,
error::{ErrorKind, SenderIgnoredErrorData},
},
assign,
events::{
@@ -325,7 +325,7 @@ where
if server_ignored {
// the sender's server is ignored, so ignore this event
return Err(Error::BadRequest(
ErrorKind::SenderIgnored { sender: None },
ErrorKind::SenderIgnored(SenderIgnoredErrorData::new()),
"The sender's server is ignored by this server.",
));
}
@@ -334,7 +334,9 @@ where
// the recipient of this PDU has the sender ignored, and we're not
// configured to send ignored messages to clients
return Err(Error::BadRequest(
ErrorKind::SenderIgnored { sender: Some(event.sender().to_owned()) },
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
event.sender().to_owned(),
)),
"You have ignored this sender.",
));
}
+1 -2
View File
@@ -44,8 +44,7 @@ fn load(db: &Arc<Database>) -> Result<Box<Ed25519KeyPair>> {
}
fn create(db: &Arc<Database>) -> Result<(String, Vec<u8>)> {
let keypair = Ed25519KeyPair::generate()
.map_err(|e| err!("Failed to generate new ed25519 keypair: {e:?}"))?;
let keypair = Ed25519KeyPair::generate();
let id = utils::rand::string(8);
debug_info!("Generated new Ed25519 keypair: {id:?}");