Skip to content

Commit 48a559c

Browse files
committed
Improve e-mail generation per review.
1 parent 1c7fb6a commit 48a559c

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ tower = "=0.4.13"
9595
tower-http = { version = "=0.4.4", features = ["fs", "catch-panic"] }
9696
tracing = "=0.1.37"
9797
tracing-subscriber = { version = "=0.3.17", features = ["env-filter"] }
98-
typomania = { version = "=0.1.0", default-features = false }
98+
typomania = { version = "=0.1.1", default-features = false }
9999
url = "=2.4.1"
100100

101101
[dev-dependencies]

src/email.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,23 @@ or go to https://{domain}/me/pending-invites to manage all of your crate ownersh
9898
crate_name: &str,
9999
squats: &[typomania::checks::Squat],
100100
) -> AppResult<()> {
101+
let domain = crate::config::domain_name();
101102
let subject = "Possible typosquatting in new crate";
102103
let body = format!(
103104
"New crate {crate_name} may be typosquatting one or more other crates.\n
104105
Visit https://{domain}/crates/{crate_name} to see the offending crate.\n
105106
\n
106107
Specific squat checks that triggered:\n
107108
\n
108-
- {squats}\n",
109-
domain = crate::config::domain_name(),
109+
{squats}",
110110
squats = squats
111111
.iter()
112-
.map(|squat| format!("{squat}"))
112+
.map(|squat| format!(
113+
"- {squat} (https://{domain}/crates/{crate_name})\n",
114+
crate_name = squat.package()
115+
))
113116
.collect::<Vec<_>>()
114-
.join("\n- "),
117+
.join(""),
115118
);
116119

117120
self.send(email, subject, &body)

0 commit comments

Comments
 (0)