cargo fmt

This commit is contained in:
murmeldin 2024-12-12 15:29:16 +01:00
parent ec3a327c3e
commit ac901ccf4a
3 changed files with 17 additions and 6 deletions

View file

@ -471,7 +471,8 @@ fn do_protocol(
wiki: &Mediawiki,
) -> Result<(), Box<dyn Error>> {
NYI!("trace/verbose annotations");
let (current_pad_id, pad_content_without_cleanup, toc, n_topics) = get_pad_info(config, hedgedoc);
let (current_pad_id, pad_content_without_cleanup, toc, n_topics) =
get_pad_info(config, hedgedoc);
if !toc.is_empty() {
let human_date = plenum_day.format("%d.%m.%Y");
let pad_content = hedgedoc::strip_metadata(pad_content_without_cleanup.clone());

View file

@ -84,7 +84,8 @@ impl std::fmt::Debug for MatrixClient {
impl MatrixClient {
pub fn new(
homeserver_url: &str, user_id: &str, access_token: &str, room_id_for_short_messages: &str, room_id_for_long_messages: &str, is_dry_run: bool,
homeserver_url: &str, user_id: &str, access_token: &str, room_id_for_short_messages: &str,
room_id_for_long_messages: &str, is_dry_run: bool,
) -> Self {
Self {
homeserver_url: homeserver_url.to_string(),
@ -175,7 +176,9 @@ impl MatrixClient {
current
}
pub fn send_room_message(&mut self, room_id: &str, text: &str) -> Result<Value, Box<dyn Error>> {
pub fn send_room_message(
&mut self, room_id: &str, text: &str,
) -> Result<Value, Box<dyn Error>> {
let content = HashMap::from([("msgtype", "m.text"), ("body", text)]);
self.send_room_event(&room_id, "m.room.message", &content)
}
@ -186,7 +189,9 @@ impl MatrixClient {
let endpoint = format!("/r0/rooms/{}/send/{}/{}", room, event_type, self.txn_id());
self.put(&endpoint, None, Some(content), false)
}
pub fn send_short_and_long_messages_to_two_rooms(&mut self, short_message: &str, long_message: &str) -> Result<(), Box<dyn Error>> {
pub fn send_short_and_long_messages_to_two_rooms(
&mut self, short_message: &str, long_message: &str,
) -> Result<(), Box<dyn Error>> {
self.send_room_message(&long_message, &self.room_id_for_long_messages.clone())?;
self.send_room_message(&short_message, &self.room_id_for_short_messages.clone())?;
Ok(())

View file

@ -301,9 +301,14 @@ impl Mediawiki {
if let Some(error) = response.get("error") {
if let Some(info) = error.get("info") {
if info == "The page you tried to create has been created already." {
verboseln!("The page you tried to create has been created already. Continuing...")
verboseln!(
"The page you tried to create has been created already. Continuing..."
)
} else {
println!("There was an error while editing the wiki: {}", info.to_string().yellow())
println!(
"There was an error while editing the wiki: {}",
info.to_string().yellow()
)
}
}
} else if let Some(edit) = response.get("edit") {