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.

feat(comms): invite email contains better message content (#3359)

Sean Aye2fca79bc3b37
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadata.ts b/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadata.ts
index 86c97efd73..ae5001d57f 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadata.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadata.ts
@@ -4,6 +4,7 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
+import type { ChannelInviteMetadataMessageContent } from './channelInviteMetadataMessageContent';
import type { ChannelInviteMetadataSenderProfilePictureUrl } from './channelInviteMetadataSenderProfilePictureUrl';
/**
@@ -14,6 +15,8 @@ export interface ChannelInviteMetadata {
channelName?: string;
/** The user who sent the invitation */
invitedBy: string;
+ /** Message content to show in the invite email, when the invite was triggered by a message. */
+ messageContent?: ChannelInviteMetadataMessageContent;
/** The sender's profile picture URL, if available. */
senderProfilePictureUrl?: ChannelInviteMetadataSenderProfilePictureUrl;
}
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadataMessageContent.ts b/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadataMessageContent.ts
new file mode 100644
index 0000000000..6b7bcbbd71
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/channelInviteMetadataMessageContent.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Message content to show in the invite email, when the invite was triggered by a message.
+ */
+export type ChannelInviteMetadataMessageContent = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/index.ts b/js/app/packages/service-clients/service-notification/generated/schemas/index.ts
index 2ebe82848b..caf4f09d4a 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/index.ts
@@ -14,6 +14,7 @@ export * from './apiUserNotificationAllOfViewedAt';
export * from './bulkGetByEventItemIdsRequest';
export * from './bulkGetTypedNotificationsByEventItemIdsParams';
export * from './channelInviteMetadata';
+export * from './channelInviteMetadataMessageContent';
export * from './channelInviteMetadataSenderProfilePictureUrl';
export * from './channelMentionMetadata';
export * from './channelMentionMetadataAllOf';
diff --git a/js/app/packages/service-clients/service-notification/generated/zod.ts b/js/app/packages/service-clients/service-notification/generated/zod.ts
index e794a31694..a90a0e6ec3 100644
--- a/js/app/packages/service-clients/service-notification/generated/zod.ts
+++ b/js/app/packages/service-clients/service-notification/generated/zod.ts
@@ -369,6 +369,12 @@ export const listTypedNotificationsResponse = zod
invitedBy: zod
.string()
.describe('The user who sent the invitation'),
+ messageContent: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Message content to show in the invite email, when the invite was triggered by a message.'
+ ),
senderProfilePictureUrl: zod
.string()
.nullish()
@@ -879,6 +885,12 @@ export const bulkGetTypedNotificationsByEventItemIdsResponse = zod
invitedBy: zod
.string()
.describe('The user who sent the invitation'),
+ messageContent: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Message content to show in the invite email, when the invite was triggered by a message.'
+ ),
senderProfilePictureUrl: zod
.string()
.nullish()
@@ -1383,6 +1395,12 @@ export const getTypedNotificationsByEventItemIdResponse = zod
invitedBy: zod
.string()
.describe('The user who sent the invitation'),
+ messageContent: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Message content to show in the invite email, when the invite was triggered by a message.'
+ ),
senderProfilePictureUrl: zod
.string()
.nullish()
@@ -1880,6 +1898,12 @@ export const getTypedNotificationByIdResponse = zod
invitedBy: zod
.string()
.describe('The user who sent the invitation'),
+ messageContent: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Message content to show in the invite email, when the invite was triggered by a message.'
+ ),
senderProfilePictureUrl: zod
.string()
.nullish()
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index f0c429c1f8..3e206dac16 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1116,6 +1116,10 @@
"type": "string",
"description": "The user who sent the invitation"
},
+ "messageContent": {
+ "type": ["string", "null"],
+ "description": "Message content to show in the invite email, when the invite was triggered by a message."
+ },
"senderProfilePictureUrl": {
"type": ["string", "null"],
"description": "The sender's profile picture URL, if available."
diff --git a/js/bun.lock b/js/bun.lock
index e2ec2551a9..abb76fa624 100644
--- a/js/bun.lock
+++ b/js/bun.lock
@@ -839,7 +839,7 @@
"@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="],
- "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009"],
+ "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009", "sha512-XLN+niDA9BkzrxiZqBjYf+DL4TLoMIcI80ypCowacVfrfAjWt0qLwLkzWVUXjD7k3v0DB/G+BP4OLJNkGygHIw=="],
"@inquirer/external-editor": ["@inquirer/[email protected]", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA=="],
@@ -2565,7 +2565,7 @@
"pathval": ["[email protected]", "", {}, "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ=="],
- "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6"],
+ "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6", "sha512-HDFaPbCxLG2GHpf1smUG97nku5aPGBGaCcIbK05dGdp07TBLUlDcXsM4WcE82mO5W4RBPIBVYobX5N/6M6NFrA=="],
"performance-now": ["[email protected]", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],
diff --git a/rust/cloud-storage/comms_service/src/api/channels/add_participants.rs b/rust/cloud-storage/comms_service/src/api/channels/add_participants.rs
index 34cb5e07a1..fd1e1985b5 100644
--- a/rust/cloud-storage/comms_service/src/api/channels/add_participants.rs
+++ b/rust/cloud-storage/comms_service/src/api/channels/add_participants.rs
@@ -119,6 +119,7 @@ pub async fn handler(
parsed_recipients,
existing_user_ids,
sender_profile_picture_url,
+ None,
metadata,
)
.await
diff --git a/rust/cloud-storage/comms_service/src/notification.rs b/rust/cloud-storage/comms_service/src/notification.rs
index 68d1dcba53..37b1ae9535 100644
--- a/rust/cloud-storage/comms_service/src/notification.rs
+++ b/rust/cloud-storage/comms_service/src/notification.rs
@@ -190,6 +190,7 @@ impl ChannelMessageEvent<'_> {
recipients_without_sender_and_mentions.into_iter().collect(),
self.existing_user_ids.clone(),
self.sender_profile_picture_url.clone(),
+ Some(self.message.content.clone()),
self.channel_metadata.clone(),
)
.await?;
@@ -224,6 +225,7 @@ impl ChannelMessageEvent<'_> {
}
}
+#[expect(clippy::too_many_arguments)]
pub async fn dispatch_notifications_for_invite(
ingres: &impl NotificationIngress,
channel_id: &Uuid,
@@ -231,6 +233,7 @@ pub async fn dispatch_notifications_for_invite(
recipient_user_ids: Vec<MacroUserIdStr<'_>>,
existing_user_ids: HashSet<String>,
sender_profile_picture_url: Option<String>,
+ message_content: Option<String>,
common: CommonChannelMetadata,
) -> anyhow::Result<()> {
let (existing_users, not_existing_users): (HashSet<_>, HashSet<_>) = recipient_user_ids
@@ -244,6 +247,7 @@ pub async fn dispatch_notifications_for_invite(
notification: ChannelInviteMetadata {
invited_by: invited_by_user_id.clone(),
channel_name: common.channel_name.clone(),
+ message_content: message_content.clone(),
sender_profile_picture_url: sender_profile_picture_url.clone(),
},
sender_id: Some(invited_by_user_id.copied().into_owned()),
@@ -259,6 +263,7 @@ pub async fn dispatch_notifications_for_invite(
notification: ChannelInviteMetadata {
invited_by: invited_by_user_id.clone(),
channel_name: common.channel_name.clone(),
+ message_content,
sender_profile_picture_url,
},
sender_id: Some(invited_by_user_id.copied().into_owned()),
diff --git a/rust/cloud-storage/invite_email/src/lib.rs b/rust/cloud-storage/invite_email/src/lib.rs
index 862f05d031..c8e59e2dc6 100644
--- a/rust/cloud-storage/invite_email/src/lib.rs
+++ b/rust/cloud-storage/invite_email/src/lib.rs
@@ -134,6 +134,9 @@ pub struct ChannelInviteMetadata {
#[serde(default)]
#[serde(alias = "channel_name")]
pub channel_name: String,
+ /// Message content to show in the invite email, when the invite was triggered by a message.
+ #[serde(default)]
+ pub message_content: Option<String>,
/// The sender's profile picture URL, if available.
#[serde(default)]
pub sender_profile_picture_url: Option<String>,
diff --git a/rust/cloud-storage/invite_email/templates/invite_to_channel.html b/rust/cloud-storage/invite_email/templates/invite_to_channel.html
index 2f20bddcc9..91205f8328 100644
--- a/rust/cloud-storage/invite_email/templates/invite_to_channel.html
+++ b/rust/cloud-storage/invite_email/templates/invite_to_channel.html
@@ -154,9 +154,13 @@
line-height: 1.4;
"
>
+ {% if let Some(content) = message_content %}
+ {{ content }}
+ {% else %}
You've been invited to join <strong>#{{ channel_name }}</strong> on Macro.
Collaborate on documents. Stay in sync with tasks. Search over
everything. AI Assistance with anything.
+ {% endif %}
</div>
<table