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(teams): team invite email links to sign up not link acceptance page (#2852)

dev-rb5382c5ed6d2b
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/inviteToTeamMetadata.ts b/js/app/packages/service-clients/service-notification/generated/schemas/inviteToTeamMetadata.ts
index 21363c7b42..85101bc561 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/inviteToTeamMetadata.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/inviteToTeamMetadata.ts
@@ -19,6 +19,8 @@ export interface InviteToTeamMetadata {
senderProfilePictureUrl?: InviteToTeamMetadataSenderProfilePictureUrl;
/** The unique identifier of the team */
teamId: string;
+ /** The unique identifier of the team invite */
+ teamInviteId: string;
/** The name of the team being invited to */
teamName: string;
}
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 aea41116c8..9be269aef9 100644
--- a/js/app/packages/service-clients/service-notification/generated/zod.ts
+++ b/js/app/packages/service-clients/service-notification/generated/zod.ts
@@ -429,6 +429,12 @@ export const listTypedNotificationsResponse = zod
.string()
.uuid()
.describe('The unique identifier of the team'),
+ teamInviteId: zod
+ .string()
+ .uuid()
+ .describe(
+ 'The unique identifier of the team invite'
+ ),
teamName: zod
.string()
.describe('The name of the team being invited to'),
@@ -861,6 +867,12 @@ export const bulkGetTypedNotificationsByEventItemIdsResponse = zod
.string()
.uuid()
.describe('The unique identifier of the team'),
+ teamInviteId: zod
+ .string()
+ .uuid()
+ .describe(
+ 'The unique identifier of the team invite'
+ ),
teamName: zod
.string()
.describe('The name of the team being invited to'),
@@ -1287,6 +1299,12 @@ export const getTypedNotificationsByEventItemIdResponse = zod
.string()
.uuid()
.describe('The unique identifier of the team'),
+ teamInviteId: zod
+ .string()
+ .uuid()
+ .describe(
+ 'The unique identifier of the team invite'
+ ),
teamName: zod
.string()
.describe('The name of the team being invited to'),
@@ -1698,6 +1716,10 @@ export const getTypedNotificationByIdResponse = zod
.string()
.uuid()
.describe('The unique identifier of the team'),
+ teamInviteId: zod
+ .string()
+ .uuid()
+ .describe('The unique identifier of the team invite'),
teamName: zod
.string()
.describe('The name of the team being invited to'),
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index 92b5cf16d1..dd6d697406 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1502,7 +1502,7 @@
"InviteToTeamMetadata": {
"type": "object",
"description": "Metadata for when a user is invited to a team.",
- "required": ["teamName", "teamId", "invitedBy"],
+ "required": ["teamName", "teamId", "teamInviteId", "invitedBy"],
"properties": {
"invitedBy": {
"type": "string",
@@ -1521,6 +1521,11 @@
"format": "uuid",
"description": "The unique identifier of the team"
},
+ "teamInviteId": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The unique identifier of the team invite"
+ },
"teamName": {
"type": "string",
"description": "The name of the team being invited to"
diff --git a/rust/cloud-storage/invite_email/src/lib.rs b/rust/cloud-storage/invite_email/src/lib.rs
index c4dd242a3f..862f05d031 100644
--- a/rust/cloud-storage/invite_email/src/lib.rs
+++ b/rust/cloud-storage/invite_email/src/lib.rs
@@ -63,7 +63,7 @@ impl Notification for InviteToMacro {
const MINUTES_PER_WEEK: u64 = 60 * 24 * 7;
-fn signup_url(env: Environment) -> Url {
+fn frontend_host(env: Environment) -> Url {
let host = match env {
Environment::Production => "https://macro.com".to_string(),
Environment::Develop => "https://dev.macro.com".to_string(),
@@ -72,7 +72,12 @@ fn signup_url(env: Environment) -> Url {
format!("http://localhost:{port}")
}
};
- let mut url = Url::parse(&host).expect("all the inputs are static, valid values");
+
+ Url::parse(&host).expect("all the inputs are static, valid values")
+}
+
+fn signup_url(env: Environment) -> Url {
+ let mut url = frontend_host(env);
url.set_path("/app/signup");
url
}
@@ -245,6 +250,9 @@ pub struct InviteToTeamMetadata {
/// The unique identifier of the team
#[serde(alias = "team_id")]
pub team_id: Uuid,
+ /// The unique identifier of the team invite
+ #[serde(alias = "team_invite_id")]
+ pub team_invite_id: Uuid,
/// The user who sent the invitation
#[serde(alias = "invited_by")]
#[schema(value_type = String)]
@@ -259,9 +267,16 @@ pub struct InviteToTeamMetadata {
}
impl InviteToTeamMetadata {
- /// Returns the signup URL for the current environment.
- pub fn signup_url(&self) -> Url {
- signup_url(Environment::new_or_prod())
+ /// Returns the team invite URL for the current environment.
+ pub fn invite_url(&self) -> Url {
+ let env = Environment::new_or_prod();
+
+ let mut url = frontend_host(env);
+ url.set_path("/app/team-invite");
+ url.query_pairs_mut()
+ .append_pair("id", &self.team_invite_id.to_string());
+
+ url
}
}
diff --git a/rust/cloud-storage/invite_email/templates/invite_to_team.html b/rust/cloud-storage/invite_email/templates/invite_to_team.html
index 8ed5d0b1b3..ce944cec51 100644
--- a/rust/cloud-storage/invite_email/templates/invite_to_team.html
+++ b/rust/cloud-storage/invite_email/templates/invite_to_team.html
@@ -193,7 +193,7 @@
padding: 4px 10px;
color: #090909;
"
- href="{{ signup_url() }}"
+ href="{{ invite_url() }}"
target="_blank"
>
Join {{ team_name }}
diff --git a/rust/cloud-storage/notification_service/src/api/user_notification/test.rs b/rust/cloud-storage/notification_service/src/api/user_notification/test.rs
index a1797d3251..0848e7c526 100644
--- a/rust/cloud-storage/notification_service/src/api/user_notification/test.rs
+++ b/rust/cloud-storage/notification_service/src/api/user_notification/test.rs
@@ -134,6 +134,7 @@ fn to_typed_row_invite_to_team() {
let metadata = serde_json::json!({
"teamName": "Engineering",
"teamId": "00000000-0000-0000-0000-000000000001",
+ "teamInviteId": "00000000-0000-0000-0000-000000000002",
"invitedBy": "macro|[email protected]",
"role": null
});
diff --git a/rust/cloud-storage/teams/src/domain/team_service.rs b/rust/cloud-storage/teams/src/domain/team_service.rs
index 8eb3a79dcf..a5b1fc0828 100644
--- a/rust/cloud-storage/teams/src/domain/team_service.rs
+++ b/rust/cloud-storage/teams/src/domain/team_service.rs
@@ -340,6 +340,7 @@ where
invite.team_invite_id,
InviteToTeamMetadata {
team_id: *team_id,
+ team_invite_id: invite.team_invite_id,
invited_by: invited_by_owned.clone(),
team_name: team_name.clone(),
role: None,