release 0.2.2 #30
3 changed files with 20 additions and 5 deletions
change order of emails sent and remove dependency between emails
commit
aae98181d5
|
|
@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Change
|
### Change
|
||||||
- some internal cleanup
|
- some internal cleanup
|
||||||
|
- reviewer notice email is now send when offer is not pre-approved
|
||||||
|
- instead of when confirmation is not skipped
|
||||||
|
- reviewer notice is now send before confirmation email
|
||||||
|
- confirmation email failure is treated as an error which would prevent the reviewer notice from being sent,
|
||||||
|
while reviewer notice failure is not
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
- confirmation emails now set the UserAgent and Auto-Submitted headers
|
- confirmation emails now set the UserAgent and Auto-Submitted headers
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,12 @@ pub(crate) async fn send_confirmation_email(
|
||||||
|
|
||||||
lettre::AsyncSendmailTransport::new().send(message).await?;
|
lettre::AsyncSendmailTransport::new().send(message).await?;
|
||||||
|
|
||||||
|
send_reviewer_notice(email_config).await;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn send_reviewer_notice(email_config: &EmailConfig) {
|
||||||
// successfully send a confirmation e-mail now send a notice to our-self
|
// successfully send a confirmation e-mail now send a notice to our-self
|
||||||
|
|
||||||
let message = lettre::Message::builder()
|
let message = lettre::Message::builder()
|
||||||
|
|
@ -84,6 +90,4 @@ pub(crate) async fn send_confirmation_email(
|
||||||
warn!("Failed to construct reminder {}", err)
|
warn!("Failed to construct reminder {}", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,9 @@ pub(crate) async fn create_job_offer<'data, 'config>(
|
||||||
|
|
||||||
let is_permanent = user.is_some() && job_offer_form.permanent;
|
let is_permanent = user.is_some() && job_offer_form.permanent;
|
||||||
|
|
||||||
let review_status = if user.is_some() && job_offer_form.pre_approved {
|
let is_pre_approved = user.is_some() && job_offer_form.pre_approved;
|
||||||
|
|
||||||
|
let review_status = if is_pre_approved {
|
||||||
ReviewStatus::Reviewed
|
ReviewStatus::Reviewed
|
||||||
} else {
|
} else {
|
||||||
ReviewStatus::AwaitingReview
|
ReviewStatus::AwaitingReview
|
||||||
|
|
@ -246,8 +248,12 @@ pub(crate) async fn create_job_offer<'data, 'config>(
|
||||||
|
|
||||||
let created_offer = offers.create_new_offer(now_date, job_offer, config).await?;
|
let created_offer = offers.create_new_offer(now_date, job_offer, config).await?;
|
||||||
|
|
||||||
if !skip_confirmation {
|
if let Some(email_config) = &config.config.email {
|
||||||
if let Some(email_config) = &config.config.email {
|
if !is_pre_approved {
|
||||||
|
email::send_reviewer_notice(&email_config).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
if !skip_confirmation {
|
||||||
let confirm_url = req.url_for(JOBOFFER_CONFIRM_ROUTE, &[created_offer.id(), &token])?;
|
let confirm_url = req.url_for(JOBOFFER_CONFIRM_ROUTE, &[created_offer.id(), &token])?;
|
||||||
|
|
||||||
email::send_confirmation_email(
|
email::send_confirmation_email(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue