diff --git a/README.md b/README.md index 75f85f25d..524b7cf69 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ Each Lemmy server can set its own moderation policy; appointing site-wide admins Lemmy is free, open-source software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project. +Lemmy is made possible by a generous grant from the [NLnet foundation](https://nlnet.nl/). + - [Support on Liberapay](https://liberapay.com/Lemmy). - [Support on Patreon](https://www.patreon.com/dessalines). - [Support on OpenCollective](https://opencollective.com/lemmy). diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 25dc10344..d51751854 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -422,17 +422,19 @@ pub async fn send_password_reset_email( // Generate a random token let token = uuid::Uuid::new_v4().to_string(); - // Insert the row - let local_user_id = user.local_user.id; - PasswordResetRequest::create_token(pool, local_user_id, token.clone()).await?; - let email = &user.local_user.email.clone().expect("email"); let lang = get_interface_language(user); let subject = &lang.password_reset_subject(&user.person.name); let protocol_and_hostname = settings.get_protocol_and_hostname(); let reset_link = format!("{}/password_change/{}", protocol_and_hostname, &token); let body = &lang.password_reset_body(reset_link, &user.person.name); - send_email(subject, email, &user.person.name, body, settings).await + send_email(subject, email, &user.person.name, body, settings).await?; + + // Insert the row after successful send, to avoid using daily reset limit while + // email sending is broken. + let local_user_id = user.local_user.id; + PasswordResetRequest::create_token(pool, local_user_id, token.clone()).await?; + Ok(()) } /// Send a verification email diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 0155ecd9b..eb209fd50 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -158,14 +158,6 @@ impl InstanceWorker { latest_id }; if id >= latest_id { - if id > latest_id { - tracing::error!( - "{}: last successful id {} is higher than latest id {} in database (did the db get cleared?)", - self.instance.domain, - id.0, - latest_id.0 - ); - } // no more work to be done, wait before rechecking tokio::select! { () = sleep(*WORK_FINISHED_RECHECK_DELAY) => {}, diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index bc20734ba..9da018960 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -210,11 +210,7 @@ cfg_if! { impl fmt::Display for LemmyError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: ", &self.error_type)?; - // print anyhow including trace - // https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations - // this will print the anyhow trace (only if it exists) - // and if RUST_BACKTRACE=1, also a full backtrace - writeln!(f, "{:?}", self.inner)?; + writeln!(f, "{}", self.inner)?; fmt::Display::fmt(&self.context, f) } }