Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): stop squishing the Macro logo in digest and invite emails (#8307)

teo9c5961f3924f
diff --git a/crates/email_formatting/README.md b/crates/email_formatting/README.md
index 22a55b8790..def970e078 100644
--- a/crates/email_formatting/README.md
+++ b/crates/email_formatting/README.md
@@ -23,6 +23,8 @@ Mobile welcome/nurture emails are owned by Loops and are not defined here.
Digest and invitation templates use the anonymously readable orange Macro PNG at
`https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0`.
+It is 174 × 116, so the templates display it at 54 × 36; keep that 3:2 ratio when
+resizing it.
Authentication templates use `https://macro.com/app/macro-email-logo.png`, served from
`apps/web/public/macro-email-logo.png`. This 192 × 192 PNG is an export of the
diff --git a/crates/email_formatting/src/test.rs b/crates/email_formatting/src/test.rs
index 93547bf7df..3e54623373 100644
--- a/crates/email_formatting/src/test.rs
+++ b/crates/email_formatting/src/test.rs
@@ -16,6 +16,28 @@ fn unsubscribe_url_keeps_gateway_prefix() {
);
}
+#[test]
+fn digest_logo_keeps_the_png_aspect_ratio() {
+ let unsubscribe_url = SignedUrl::new(
+ NotificationServiceUrl::default_for_environment(Environment::Production)
+ .parse_url()
+ .unwrap(),
+ Hmac::<Sha256>::new_from_slice(b"test-secret").unwrap(),
+ );
+ let html = DigestTemplate {
+ notifs: Vec::new(),
+ num_truncated: 0,
+ total_count: 0,
+ unsubscribe_url,
+ }
+ .render()
+ .unwrap();
+ let html = html.split_whitespace().collect::<Vec<_>>().join(" ");
+ assert!(html.contains(
+ r#"src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0" width="54" height="36""#
+ ));
+}
+
#[test]
fn signed_unsubscribe_roundtrips_against_request_url() {
let secret = Hmac::<Sha256>::new_from_slice(b"test-secret").unwrap();
diff --git a/crates/email_formatting/templates/digest.html b/crates/email_formatting/templates/digest.html
index ac015ec908..7233539f3e 100644
--- a/crates/email_formatting/templates/digest.html
+++ b/crates/email_formatting/templates/digest.html
@@ -98,11 +98,11 @@
style="margin-bottom: 36px"
>
<tr>
- <td width="36" style="vertical-align: middle">
+ <td width="54" style="vertical-align: middle">
<a href="https://macro.com" style="text-decoration: none"
><img
src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0"
- width="36"
+ width="54"
height="36"
alt="Macro"
style="
diff --git a/crates/invite_email/src/test.rs b/crates/invite_email/src/test.rs
index 69780af909..28358169f6 100644
--- a/crates/invite_email/src/test.rs
+++ b/crates/invite_email/src/test.rs
@@ -269,6 +269,29 @@ fn make_invite() -> InviteToMacro {
}
}
+#[test]
+fn invitation_logos_keep_the_png_aspect_ratio() {
+ let team_invite = InviteToTeamMetadata {
+ team_name: "Acme".to_string(),
+ team_id: Uuid::nil(),
+ team_invite_id: Uuid::nil(),
+ invited_by: MacroUserIdStr::try_from_email("[email protected]").unwrap(),
+ role: None,
+ sender_profile_picture_url: None,
+ };
+ for email in [
+ make_invite().format_email(),
+ make_channel_invite().format_email(),
+ team_invite.format_email(),
+ make_colleague_joined().format_email(),
+ ] {
+ let body = email.body.split_whitespace().collect::<Vec<_>>().join(" ");
+ assert!(body.contains(
+ r#"src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0" width="54" height="36""#
+ ));
+ }
+}
+
#[test]
fn referral_url_does_not_panic() {
let invite = make_invite();
diff --git a/crates/invite_email/templates/colleague_joined_macro.html b/crates/invite_email/templates/colleague_joined_macro.html
index 99f22f9faf..a54c45c039 100644
--- a/crates/invite_email/templates/colleague_joined_macro.html
+++ b/crates/invite_email/templates/colleague_joined_macro.html
@@ -97,11 +97,11 @@
style="margin-bottom: 36px"
>
<tr>
- <td width="36" style="vertical-align: middle">
+ <td width="54" style="vertical-align: middle">
<a href="https://macro.com" style="text-decoration: none"
><img
src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0"
- width="36"
+ width="54"
height="36"
alt="Macro"
style="
diff --git a/crates/invite_email/templates/invite.html b/crates/invite_email/templates/invite.html
index 91fadb98a6..834e7c003d 100644
--- a/crates/invite_email/templates/invite.html
+++ b/crates/invite_email/templates/invite.html
@@ -97,11 +97,11 @@
style="margin-bottom: 36px"
>
<tr>
- <td width="36" style="vertical-align: middle">
+ <td width="54" style="vertical-align: middle">
<a href="https://macro.com" style="text-decoration: none"
><img
src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0"
- width="36"
+ width="54"
height="36"
alt="Macro"
style="
diff --git a/crates/invite_email/templates/invite_to_channel.html b/crates/invite_email/templates/invite_to_channel.html
index 54a0b93f2f..ac86ef78f2 100644
--- a/crates/invite_email/templates/invite_to_channel.html
+++ b/crates/invite_email/templates/invite_to_channel.html
@@ -105,11 +105,11 @@
style="margin-bottom: 36px"
>
<tr>
- <td width="36" style="vertical-align: middle">
+ <td width="54" style="vertical-align: middle">
<a href="https://macro.com" style="text-decoration: none"
><img
src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0"
- width="36"
+ width="54"
height="36"
alt="Macro"
style="
diff --git a/crates/invite_email/templates/invite_to_team.html b/crates/invite_email/templates/invite_to_team.html
index 041ca570ae..8598f18150 100644
--- a/crates/invite_email/templates/invite_to_team.html
+++ b/crates/invite_email/templates/invite_to_team.html
@@ -97,11 +97,11 @@
style="margin-bottom: 36px"
>
<tr>
- <td width="36" style="vertical-align: middle">
+ <td width="54" style="vertical-align: middle">
<a href="https://macro.com" style="text-decoration: none"
><img
src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0"
- width="36"
+ width="54"
height="36"
alt="Macro"
style="
diff --git a/crates/ses_client/src/invite_user/test.rs b/crates/ses_client/src/invite_user/test.rs
index 2e66fc0590..72365aead2 100644
--- a/crates/ses_client/src/invite_user/test.rs
+++ b/crates/ses_client/src/invite_user/test.rs
@@ -11,6 +11,15 @@ fn escapes_organization_html() {
assert!(!result.contains(org_name));
}
+#[test]
+fn logo_keeps_the_png_aspect_ratio() {
+ let result = build_user_invite_message("Acme", "prod");
+ let result = result.split_whitespace().collect::<Vec<_>>().join(" ");
+ assert!(result.contains(
+ r#"src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0" width="54" height="36""#
+ ));
+}
+
#[test]
fn preserves_organization_text_and_environment_links() {
for (environment, prefix) in [("prod", ""), ("staging", "staging."), ("dev", "dev.")] {
diff --git a/crates/ses_client/templates/invite_user.html b/crates/ses_client/templates/invite_user.html
index 420cac335f..6354db3c06 100644
--- a/crates/ses_client/templates/invite_user.html
+++ b/crates/ses_client/templates/invite_user.html
@@ -97,11 +97,11 @@
style="margin-bottom: 36px"
>
<tr>
- <td width="36" style="vertical-align: middle">
+ <td width="54" style="vertical-align: middle">
<a href="https://macro.com" style="text-decoration: none"
><img
src="https://static-file-service.macro.com/file/b911aba9-94a6-435c-aa16-8404739f13b0"
- width="36"
+ width="54"
height="36"
alt="Macro"
style="