Skip to content

Commit

Permalink
feat!: [#591] rename enum variant EmailOnSignup::None to Ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Jun 12, 2024
1 parent bb75303 commit 82fc32c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/config/v1/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub enum EmailOnSignup {
/// The email is optional on signup.
Optional,
/// The email is not allowed on signup. It will only be ignored if provided.
None, // code-review: rename to `Ignored`?
Ignored,
}

impl Default for EmailOnSignup {
Expand All @@ -72,7 +72,7 @@ impl fmt::Display for EmailOnSignup {
let display_str = match self {
EmailOnSignup::Required => "required",
EmailOnSignup::Optional => "optional",
EmailOnSignup::None => "none",
EmailOnSignup::Ignored => "ignored",
};
write!(f, "{display_str}")
}
Expand All @@ -85,8 +85,10 @@ impl FromStr for EmailOnSignup {
match s.to_lowercase().as_str() {
"required" => Ok(EmailOnSignup::Required),
"optional" => Ok(EmailOnSignup::Optional),
"none" => Ok(EmailOnSignup::None),
_ => Err(format!("Unknown config 'email_on_signup' option (required, optional, none): {s}")),
"none" => Ok(EmailOnSignup::Ignored),
_ => Err(format!(
"Unknown config 'email_on_signup' option (required, optional, ignored): {s}"
)),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl RegistrationService {
}
registration_form.email.clone()
}
EmailOnSignup::None => None,
EmailOnSignup::Ignored => None,
EmailOnSignup::Optional => registration_form.email.clone(),
};

Expand Down

0 comments on commit 82fc32c

Please sign in to comment.