From 09d71a2a4f13c984c784feb9bfe8dbda88c55d06 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 28 Mar 2020 13:48:04 +0100 Subject: [PATCH] mail: don't take an i18n argument in send_welcome --- src/mail.rs | 5 ++--- src/web/hkp.rs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mail.rs b/src/mail.rs index 6159015..6cfe169 100644 --- a/src/mail.rs +++ b/src/mail.rs @@ -150,14 +150,13 @@ impl Service { pub fn send_welcome( &self, - i18n: &I18n, base_uri: &str, tpk_name: String, userid: &Email, token: &str ) -> Result<()> { let ctx = context::Welcome { - lang: i18n.lang.to_string(), + lang: "en".to_owned(), primary_fp: tpk_name, uri: format!("{}/upload/{}", base_uri, token), base_uri: base_uri.to_owned(), @@ -170,7 +169,7 @@ impl Service { &vec![userid], &format!("Your key upload on {domain}", domain = self.domain), "welcome", - i18n.lang, + "en", ctx, ) } diff --git a/src/web/hkp.rs b/src/web/hkp.rs index e962ebe..2672fb7 100644 --- a/src/web/hkp.rs +++ b/src/web/hkp.rs @@ -142,7 +142,7 @@ pub fn pks_add_form( ) -> MyResponse { match vks_web::process_post_form(&db, &tokens_stateless, &rate_limiter, &i18n, data) { Ok(UploadResponse::Ok { is_new_key, key_fpr, primary_uid, token, .. }) => { - let msg = if is_new_key && send_welcome_mail(&request_origin, &mail_service, &i18n, key_fpr, primary_uid, token) { + let msg = if is_new_key && send_welcome_mail(&request_origin, &mail_service, key_fpr, primary_uid, token) { format!("Upload successful. This is a new key, a welcome email has been sent.") } else { format!("Upload successful. Please note that identity information will only be published after verification. See {baseuri}/about/usage#gnupg-upload", baseuri = request_origin.get_base_uri()) @@ -160,14 +160,13 @@ pub fn pks_add_form( fn send_welcome_mail( request_origin: &RequestOrigin, mail_service: &mail::Service, - i18n: &I18n, fpr: String, primary_uid: Option, token: String, ) -> bool { if let Some(primary_uid) = primary_uid { mail_service.send_welcome( - i18n, request_origin.get_base_uri(), fpr, &primary_uid, &token).is_ok() + request_origin.get_base_uri(), fpr, &primary_uid, &token).is_ok() } else { false }