1
0
Fork 0
mirror of https://gitlab.com/hagrid-keyserver/hagrid.git synced 2023-02-13 20:55:02 -05:00

mail: don't take an i18n argument in send_welcome

This commit is contained in:
Vincent Breitmoser 2020-03-28 13:48:04 +01:00
parent 1082339c77
commit 09d71a2a4f
No known key found for this signature in database
GPG key ID: 7BD18320DEADFA11
2 changed files with 4 additions and 6 deletions

View file

@ -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,
)
}

View file

@ -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<Email>,
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
}