From f2e2f87c199d4ddb4cbc021acb8971f366bf663b Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Thu, 30 Oct 2025 11:11:45 +0100 Subject: [PATCH] Add version link to publish notification emails Include a direct link to the newly published version in publish notification emails sent to crate owners. The email body now displays the version link on a separate line for better visibility: View v1.0.0 here: https://crates.io/crates/foo/1.0.0 --- src/email/templates/publish_notification/body.txt.j2 | 4 +++- ...gration__krate__publish__basics__new_krate-5.snap | 4 +++- ...tion__krate__publish__trustpub__full_flow-11.snap | 8 ++++++-- ...utes__crates__delete__happy_path_new_crate-3.snap | 4 +++- ...utes__crates__delete__happy_path_old_crate-3.snap | 4 +++- ...rates__delete__happy_path_really_old_crate-3.snap | 4 +++- ...otifications__unsubscribe_and_resubscribe-11.snap | 8 ++++++-- ...notifications__unsubscribe_and_resubscribe-2.snap | 4 +++- ...notifications__unsubscribe_and_resubscribe-5.snap | 4 +++- ...notifications__unsubscribe_and_resubscribe-7.snap | 4 +++- .../integration__owners__new_crate_owner-2.snap | 12 +++++++++--- .../integration__owners__new_crate_owner.snap | 4 +++- .../snapshots/integration__team__publish_owned.snap | 4 +++- src/worker/jobs/send_publish_notifications.rs | 3 ++- 14 files changed, 53 insertions(+), 18 deletions(-) diff --git a/src/email/templates/publish_notification/body.txt.j2 b/src/email/templates/publish_notification/body.txt.j2 index d4c03031836..409c988a6f5 100644 --- a/src/email/templates/publish_notification/body.txt.j2 +++ b/src/email/templates/publish_notification/body.txt.j2 @@ -3,7 +3,9 @@ {% block content %} Hello {{ recipient }}! -A new version of the package {{ krate }} ({{ version }}) was published{{ publisher_info }} at {{ publish_time }}. +A new version of {{ krate }} crate was published{{ publisher_info }} at {{ publish_time }}. + +View v{{ version }} here: https://{{ domain }}/crates/{{ krate }}/{{ version }} If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. {% endblock %} diff --git a/src/tests/krate/publish/snapshots/integration__krate__publish__basics__new_krate-5.snap b/src/tests/krate/publish/snapshots/integration__krate__publish__basics__new_krate-5.snap index 6e0259a0569..cd479b058fa 100644 --- a/src/tests/krate/publish/snapshots/integration__krate__publish__basics__new_krate-5.snap +++ b/src/tests/krate/publish/snapshots/integration__krate__publish__basics__new_krate-5.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo_new (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo_new crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo_new/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/krate/publish/snapshots/integration__krate__publish__trustpub__full_flow-11.snap b/src/tests/krate/publish/snapshots/integration__krate__publish__trustpub__full_flow-11.snap index 7348c9a5fee..428ace91368 100644 --- a/src/tests/krate/publish/snapshots/integration__krate__publish__trustpub__full_flow-11.snap +++ b/src/tests/krate/publish/snapshots/integration__krate__publish__trustpub__full_flow-11.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. @@ -49,7 +51,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.1.0) was published by GitHub Actions (https://github.com/rust-lang/foo-rs/actions/runs/example-run-id) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by GitHub Actions (https://github.com/rust-lang/foo-rs/actions/runs/example-run-id) at [0000-00-00T00:00:00Z]. + +View v1.1.0 here: https://crates.io/crates/foo/1.1.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_new_crate-3.snap b/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_new_crate-3.snap index 79080d995e3..b531b89194c 100644 --- a/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_new_crate-3.snap +++ b/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_new_crate-3.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_old_crate-3.snap b/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_old_crate-3.snap index 79080d995e3..b531b89194c 100644 --- a/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_old_crate-3.snap +++ b/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_old_crate-3.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_really_old_crate-3.snap b/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_really_old_crate-3.snap index 79080d995e3..b531b89194c 100644 --- a/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_really_old_crate-3.snap +++ b/src/tests/routes/crates/snapshots/integration__routes__crates__delete__happy_path_really_old_crate-3.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-11.snap b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-11.snap index 200c3aff74a..4ae8fd08f9e 100644 --- a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-11.snap +++ b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-11.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. @@ -45,7 +47,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.2.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.2.0 here: https://crates.io/crates/foo/1.2.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-2.snap b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-2.snap index ff2b348ee3a..d51bd610cf3 100644 --- a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-2.snap +++ b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-2.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-5.snap b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-5.snap index abfa2608912..83c9053c4b6 100644 --- a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-5.snap +++ b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-5.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-7.snap b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-7.snap index abfa2608912..83c9053c4b6 100644 --- a/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-7.snap +++ b/src/tests/routes/users/update/snapshots/integration__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-7.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/snapshots/integration__owners__new_crate_owner-2.snap b/src/tests/snapshots/integration__owners__new_crate_owner-2.snap index ffdda591775..e688aa97ccf 100644 --- a/src/tests/snapshots/integration__owners__new_crate_owner-2.snap +++ b/src/tests/snapshots/integration__owners__new_crate_owner-2.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo_owner (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo_owner crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo_owner/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. @@ -45,7 +47,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo_owner (2.0.0) was published by Bar (https://crates.io/users/Bar) at [0000-00-00T00:00:00Z]. +A new version of foo_owner crate was published by Bar (https://crates.io/users/Bar) at [0000-00-00T00:00:00Z]. + +View v2.0.0 here: https://crates.io/crates/foo_owner/2.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. @@ -62,7 +66,9 @@ Content-Transfer-Encoding: quoted-printable Hello Bar! -A new version of the package foo_owner (2.0.0) was published by your account (https://crates.io/users/Bar) at [0000-00-00T00:00:00Z]. +A new version of foo_owner crate was published by your account (https://crates.io/users/Bar) at [0000-00-00T00:00:00Z]. + +View v2.0.0 here: https://crates.io/crates/foo_owner/2.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/snapshots/integration__owners__new_crate_owner.snap b/src/tests/snapshots/integration__owners__new_crate_owner.snap index f3bc6c0907c..f86c1cf538d 100644 --- a/src/tests/snapshots/integration__owners__new_crate_owner.snap +++ b/src/tests/snapshots/integration__owners__new_crate_owner.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello foo! -A new version of the package foo_owner (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. +A new version of foo_owner crate was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z]. + +View v1.0.0 here: https://crates.io/crates/foo_owner/1.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/tests/snapshots/integration__team__publish_owned.snap b/src/tests/snapshots/integration__team__publish_owned.snap index 1ee1e1d8798..26254c0f187 100644 --- a/src/tests/snapshots/integration__team__publish_owned.snap +++ b/src/tests/snapshots/integration__team__publish_owned.snap @@ -11,7 +11,9 @@ Content-Transfer-Encoding: quoted-printable Hello user-all-teams! -A new version of the package foo_team_owned (2.0.0) was published by user-one-team (https://crates.io/users/user-one-team) at [0000-00-00T00:00:00Z]. +A new version of foo_team_owned crate was published by user-one-team (https://crates.io/users/user-one-team) at [0000-00-00T00:00:00Z]. + +View v2.0.0 here: https://crates.io/crates/foo_team_owned/2.0.0 If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings. diff --git a/src/worker/jobs/send_publish_notifications.rs b/src/worker/jobs/send_publish_notifications.rs index 689d59f9b4e..4942d4fef30 100644 --- a/src/worker/jobs/send_publish_notifications.rs +++ b/src/worker/jobs/send_publish_notifications.rs @@ -107,7 +107,8 @@ impl BackgroundJob for SendPublishNotificationsJob { krate => krate, version => version, publish_time => publish_time, - publisher_info => publisher_info + publisher_info => publisher_info, + domain => ctx.config.domain_name }, );