refactor(users): Move hardcoded email subjects to constants (#6110)

This commit is contained in:
Summer Gram
2024-10-16 14:47:15 +08:00
committed by GitHub
parent 6aa6b7bdc6
commit 899ec23565
6 changed files with 26 additions and 13 deletions

View File

@ -74,7 +74,7 @@ pub async fn signup_with_merchant_id(
recipient_email: user_from_db.get_email().try_into()?,
user_name: domain::UserName::new(user_from_db.get_name())?,
settings: state.conf.clone(),
subject: "Get back to Hyperswitch - Reset Your Password Now",
subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,
auth_id,
};
@ -202,7 +202,7 @@ pub async fn connect_account(
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
user_name: domain::UserName::new(user_from_db.get_name())?,
subject: "Unlock Hyperswitch: Use Your Magic Link to Sign In",
subject: consts::user::EMAIL_SUBJECT_MAGIC_LINK,
auth_id,
};
@ -251,7 +251,7 @@ pub async fn connect_account(
let email_contents = email_types::VerifyEmail {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
subject: "Welcome to the Hyperswitch community!",
subject: consts::user::EMAIL_SUBJECT_SIGNUP,
auth_id,
};
@ -371,7 +371,7 @@ pub async fn forgot_password(
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
user_name: domain::UserName::new(user_from_db.get_name())?,
subject: "Get back to Hyperswitch - Reset Your Password Now",
subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,
auth_id,
};
@ -709,7 +709,7 @@ async fn handle_existing_user_invitation(
recipient_email: invitee_email,
user_name: domain::UserName::new(invitee_user_from_db.get_name())?,
settings: state.conf.clone(),
subject: "You have been invited to join Hyperswitch Community!",
subject: consts::user::EMAIL_SUBJECT_INVITATION,
entity,
auth_id: auth_id.clone(),
};
@ -840,7 +840,7 @@ async fn handle_new_user_invitation(
recipient_email: invitee_email,
user_name: domain::UserName::new(new_user.get_name())?,
settings: state.conf.clone(),
subject: "You have been invited to join Hyperswitch Community!",
subject: consts::user::EMAIL_SUBJECT_INVITATION,
entity,
auth_id: auth_id.clone(),
};
@ -959,7 +959,7 @@ pub async fn resend_invite(
recipient_email: invitee_email,
user_name: domain::UserName::new(user.get_name())?,
settings: state.conf.clone(),
subject: "You have been invited to join Hyperswitch Community!",
subject: consts::user::EMAIL_SUBJECT_INVITATION,
entity: email_types::Entity {
entity_id,
entity_type,
@ -1498,7 +1498,7 @@ pub async fn send_verification_mail(
let email_contents = email_types::VerifyEmail {
recipient_email: domain::UserEmail::from_pii_email(user.email)?,
settings: state.conf.clone(),
subject: "Welcome to the Hyperswitch community!",
subject: consts::user::EMAIL_SUBJECT_SIGNUP,
auth_id,
};