Skip to content

Commit

Permalink
Improve e-mail generation per review.
Browse files Browse the repository at this point in the history
  • Loading branch information
LawnGnome committed Oct 13, 2023
1 parent 1c7fb6a commit 48a559c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tower = "=0.4.13"
tower-http = { version = "=0.4.4", features = ["fs", "catch-panic"] }
tracing = "=0.1.37"
tracing-subscriber = { version = "=0.3.17", features = ["env-filter"] }
typomania = { version = "=0.1.0", default-features = false }
typomania = { version = "=0.1.1", default-features = false }
url = "=2.4.1"

[dev-dependencies]
Expand Down
11 changes: 7 additions & 4 deletions src/email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,23 @@ or go to https://{domain}/me/pending-invites to manage all of your crate ownersh
crate_name: &str,
squats: &[typomania::checks::Squat],
) -> AppResult<()> {
let domain = crate::config::domain_name();
let subject = "Possible typosquatting in new crate";
let body = format!(
"New crate {crate_name} may be typosquatting one or more other crates.\n
Visit https://{domain}/crates/{crate_name} to see the offending crate.\n
\n
Specific squat checks that triggered:\n
\n
- {squats}\n",
domain = crate::config::domain_name(),
{squats}",
squats = squats
.iter()
.map(|squat| format!("{squat}"))
.map(|squat| format!(
"- {squat} (https://{domain}/crates/{crate_name})\n",
crate_name = squat.package()
))
.collect::<Vec<_>>()
.join("\n- "),
.join(""),
);

self.send(email, subject, &body)
Expand Down

0 comments on commit 48a559c

Please sign in to comment.