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(notifications): normalize call_started notification type from kebab-case to snake_case (#4185)

teo0723d778a8f3
diff --git a/js/app/packages/core/types/index.ts b/js/app/packages/core/types/index.ts
index c374bf2a63..9161f93625 100644
--- a/js/app/packages/core/types/index.ts
+++ b/js/app/packages/core/types/index.ts
@@ -17,6 +17,6 @@ export type Entity = {
};
import type { NotifEvent } from '@service-notification/generated/schemas';
-export type NotificationType = NotifEvent['tag'] | 'call-started';
+export type NotificationType = NotifEvent['tag'] | 'call_started';
export type Maybe<T> = T | undefined;
diff --git a/js/app/packages/entity/src/extractors-notification/notification-description-helpers.ts b/js/app/packages/entity/src/extractors-notification/notification-description-helpers.ts
index 05f75c3f44..86c2b7a8db 100644
--- a/js/app/packages/entity/src/extractors-notification/notification-description-helpers.ts
+++ b/js/app/packages/entity/src/extractors-notification/notification-description-helpers.ts
@@ -40,7 +40,7 @@ export function getActionVerb(type: NotificationType): string {
.with('github_pr_comment', () => 'commented on a pull request')
.with('github_pr_mention', () => 'mentioned you on a pull request')
.with('github_pr_review', () => 'reviewed your pull request')
- .with('call-started', () => 'started a call')
+ .with('call_started', () => 'started a call')
.with('inbox_reauth_required', () => 'needs reconnection')
.exhaustive();
}
@@ -79,7 +79,7 @@ export function getTypeNoun(type: NotificationType, count: number): string {
.with('github_pr_comment', () => (count === 1 ? 'comment' : 'comments'))
.with('github_pr_mention', () => (count === 1 ? 'mention' : 'mentions'))
.with('github_pr_review', () => (count === 1 ? 'review' : 'reviews'))
- .with('call-started', () => (count === 1 ? 'call' : 'calls'))
+ .with('call_started', () => (count === 1 ? 'call' : 'calls'))
.with('inbox_reauth_required', () => (count === 1 ? 'inbox' : 'inboxes'))
.exhaustive();
}
diff --git a/js/app/packages/entity/src/extractors-notification/notification-icon.tsx b/js/app/packages/entity/src/extractors-notification/notification-icon.tsx
index 09e8102518..c72ec53d63 100644
--- a/js/app/packages/entity/src/extractors-notification/notification-icon.tsx
+++ b/js/app/packages/entity/src/extractors-notification/notification-icon.tsx
@@ -51,7 +51,7 @@ function getNotificationIcon(
),
() => GithubIcon
)
- .with('call-started', () => PhoneIcon)
+ .with('call_started', () => PhoneIcon)
.with('inbox_reauth_required', () => EnvelopeIcon)
.exhaustive();
}
diff --git a/js/app/packages/entity/src/extractors-notification/notification-row.tsx b/js/app/packages/entity/src/extractors-notification/notification-row.tsx
index 57ac3b71b0..adfa19eb15 100644
--- a/js/app/packages/entity/src/extractors-notification/notification-row.tsx
+++ b/js/app/packages/entity/src/extractors-notification/notification-row.tsx
@@ -97,7 +97,7 @@ function NotificationRowContent(props: {
<Match when={tag() === 'invite_to_team'}>
<span class="text-xs text-ink-muted/80 italic">to join the team</span>
</Match>
- <Match when={tag() === 'call-started'}>
+ <Match when={tag() === 'call_started'}>
<span class="text-xs text-ink-muted/80 italic">
started a call you can join
</span>
@@ -116,7 +116,7 @@ interface NotificationRowProps {
content?: JSX.Element;
/**
* Whether the "Mark done" affordance is available. Defaults to true except
- * for `call-started`, which has no meaningful "done" state.
+ * for `call_started`, which has no meaningful "done" state.
*/
showMarkDone?: boolean;
/**
@@ -305,7 +305,7 @@ export function NotificationRow(props: NotificationRowProps) {
const canMarkDone = () =>
props.showMarkDone !== false &&
(props.notification.notification_metadata.tag as NotificationType) !==
- 'call-started';
+ 'call_started';
const { markAsDone, markAsRead } = useNotificationActions({
notification: props.notification,
diff --git a/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx b/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx
index 1d8f4b9f2d..128f4e194a 100644
--- a/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx
+++ b/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx
@@ -57,7 +57,7 @@ export function NotificationStackRow(props: {
const notificationSource = useGlobalNotificationSource();
const unread = () => isNotificationUnread(props.stack);
const canMarkDone = () =>
- props.showMarkDone !== false && props.stack.type !== 'call-started';
+ props.showMarkDone !== false && props.stack.type !== 'call_started';
const { markStackAsDone, markStackAsRead } = useNotificationStackActions({
stack: props.stack,
diff --git a/js/app/packages/entity/src/utils/notification.ts b/js/app/packages/entity/src/utils/notification.ts
index d1d01aa605..110b215f88 100644
--- a/js/app/packages/entity/src/utils/notification.ts
+++ b/js/app/packages/entity/src/utils/notification.ts
@@ -7,7 +7,7 @@ import type { EntityData } from '../types/entity';
import type { Notification } from '../types/notification';
type CallStartedNotificationMetadata = {
- tag: 'call-started';
+ tag: 'call_started';
content: {
channel_name?: string | null;
};
@@ -136,7 +136,7 @@ export function getNotificationActionText(n: Notification): string {
.with('github_pr_comment', () => 'commented')
.with('github_pr_mention', () => 'mentioned')
.with('github_pr_review', () => 'reviewed')
- .with('call-started', () => 'called')
+ .with('call_started', () => 'called')
.with('inbox_reauth_required', () => 'needs reconnection')
.exhaustive();
}
@@ -197,7 +197,7 @@ export function extractMessageContent(notification: Notification): string {
)
.with({ tag: 'channel_invite' }, () => '')
.with({ tag: 'invite_to_team' }, () => '')
- .with({ tag: 'call-started' }, (m) => m.content.channel_name ?? '')
+ .with({ tag: 'call_started' }, (m) => m.content.channel_name ?? '')
.with({ tag: 'inbox_reauth_required' }, (m) => m.content.emailAddress || '')
.exhaustive();
}
diff --git a/js/app/packages/notifications/notification-metadata.ts b/js/app/packages/notifications/notification-metadata.ts
index 13a67f630b..818c8310ca 100644
--- a/js/app/packages/notifications/notification-metadata.ts
+++ b/js/app/packages/notifications/notification-metadata.ts
@@ -14,6 +14,7 @@ export function getNotificationAction(n: UnifiedNotification): string {
.with('channel_message_send', () => 'sent a message in')
.with('ai_response', () => 'AI responded')
.with('channel_message_reply', () => 'replied in')
+ .with('call_started', () => 'started a call')
.with('channel_invite', () => 'invited you to')
.with('new_email', () => 'sent a new email')
.with('invite_to_team', () => 'invited you to')
@@ -64,6 +65,7 @@ export function getNotificationTargetName(
.with({ tag: 'channel_message_send' }, () => undefined)
.with({ tag: 'ai_response' }, () => undefined)
.with({ tag: 'channel_message_reply' }, () => undefined)
+ .with({ tag: 'call_started' }, (m) => m.content.channel_name ?? undefined)
.with({ tag: 'new_email' }, () => undefined)
.with({ tag: 'inbox_reauth_required' }, () => undefined)
.exhaustive();
@@ -78,6 +80,7 @@ export function getNotificationContent(
.with({ tag: 'channel_message_send' }, (m) => m.content.messageContent)
.with({ tag: 'ai_response' }, (m) => m.content.summary)
.with({ tag: 'channel_message_reply' }, (m) => m.content.messageContent)
+ .with({ tag: 'call_started' }, () => undefined)
.with({ tag: 'document_mention' }, (m) => m.content.documentName)
.with({ tag: 'mentioned_in_document_comment' }, (m) => m.content.text)
.with({ tag: 'replied_to_document_comment_thread' }, (m) => m.content.text)
@@ -127,6 +130,7 @@ export function shouldShowNotificationTarget(n: UnifiedNotification): boolean {
(m) => m.content.channelType !== 'directMessage'
)
.with({ tag: 'ai_response' }, () => false)
+ .with({ tag: 'call_started' }, () => true)
.with({ tag: 'new_email' }, () => false)
.with({ tag: 'task_assigned' }, () => true)
.with({ tag: P.union(...GITHUB_EVENT_TYPES) }, () => true)
diff --git a/js/app/packages/notifications/notification-navigation.ts b/js/app/packages/notifications/notification-navigation.ts
index 2ea2b0640d..acb0452282 100644
--- a/js/app/packages/notifications/notification-navigation.ts
+++ b/js/app/packages/notifications/notification-navigation.ts
@@ -225,7 +225,7 @@ function getSupportedHandler(
})
.with('invite_to_team', () => null)
.with(
- 'call-started',
+ 'call_started',
() =>
async (lm: SplitManager, newSplit: boolean = false) =>
openSplitIfNotOpen(lm, 'channel', notification.entity_id, {
diff --git a/js/app/packages/notifications/notification-preview.ts b/js/app/packages/notifications/notification-preview.ts
index 711a8c0b15..8a1b44c1da 100644
--- a/js/app/packages/notifications/notification-preview.ts
+++ b/js/app/packages/notifications/notification-preview.ts
@@ -19,6 +19,6 @@ export const NOTIFICATION_LABEL_BY_TYPE: Record<NotificationType, string> = {
github_pr_comment: 'COMMENT',
github_pr_mention: 'MENTION',
github_pr_review: 'REVIEW',
- 'call-started': 'CALL',
+ call_started: 'CALL',
inbox_reauth_required: 'EMAIL',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadata.ts b/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadata.ts
new file mode 100644
index 0000000000..941afee23d
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadata.ts
@@ -0,0 +1,28 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { CallStartedMetadataChannelName } from './callStartedMetadataChannelName';
+import type { CallStartedMetadataSenderProfilePictureUrl } from './callStartedMetadataSenderProfilePictureUrl';
+
+/**
+ * Metadata for a notification that a call has started in a channel.
+
+Mirrors the producer-side `CallStartedNotification` in the `call` crate:
+both serialize the same wire shape (snake_case fields) under the same
+`call_started` [`Notification::TYPE_NAME`]. This type is the read-side
+model used by [`crate::NotifEvent`]; the producer keeps its own type
+because it additionally builds the incoming-call APNS/VoIP push.
+
+Rows persisted before the type name was normalized used the kebab-case
+`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a
+`#[serde(alias = "call-started")]` so those rows still deserialize.
+ */
+export interface CallStartedMetadata {
+ /** The name of the channel the call started in, when available. */
+ channel_name?: CallStartedMetadataChannelName;
+ /** Profile picture URL of the user who started the call, when available. */
+ sender_profile_picture_url?: CallStartedMetadataSenderProfilePictureUrl;
+}
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadataChannelName.ts b/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadataChannelName.ts
new file mode 100644
index 0000000000..6afe6a1ead
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadataChannelName.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * The name of the channel the call started in, when available.
+ */
+export type CallStartedMetadataChannelName = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadataSenderProfilePictureUrl.ts b/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadataSenderProfilePictureUrl.ts
new file mode 100644
index 0000000000..eca4501633
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/callStartedMetadataSenderProfilePictureUrl.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Profile picture URL of the user who started the call, when available.
+ */
+export type CallStartedMetadataSenderProfilePictureUrl = 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 6fc2ee3352..1c8e597250 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
@@ -13,6 +13,9 @@ export * from './apiUserNotificationAllOfSenderId';
export * from './apiUserNotificationAllOfViewedAt';
export * from './bulkGetByEventItemIdsRequest';
export * from './bulkGetTypedNotificationsByEventItemIdsParams';
+export * from './callStartedMetadata';
+export * from './callStartedMetadataChannelName';
+export * from './callStartedMetadataSenderProfilePictureUrl';
export * from './channelInviteMetadata';
export * from './channelInviteMetadataMessageContent';
export * from './channelInviteMetadataSenderProfilePictureUrl';
@@ -132,6 +135,8 @@ export * from './notifEventOneOfTag';
export * from './notifEventOneOfThree';
export * from './notifEventOneOfThreefive';
export * from './notifEventOneOfThreefiveTag';
+export * from './notifEventOneOfThreenine';
+export * from './notifEventOneOfThreenineTag';
export * from './notifEventOneOfThreeone';
export * from './notifEventOneOfThreeoneTag';
export * from './notifEventOneOfThreeseven';
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEvent.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEvent.ts
index b04b54319c..e7fbf0831c 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEvent.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEvent.ts
@@ -15,6 +15,7 @@ import type { NotifEventOneOfOnethree } from './notifEventOneOfOnethree';
import type { NotifEventOneOfSeven } from './notifEventOneOfSeven';
import type { NotifEventOneOfThree } from './notifEventOneOfThree';
import type { NotifEventOneOfThreefive } from './notifEventOneOfThreefive';
+import type { NotifEventOneOfThreenine } from './notifEventOneOfThreenine';
import type { NotifEventOneOfThreeone } from './notifEventOneOfThreeone';
import type { NotifEventOneOfThreeseven } from './notifEventOneOfThreeseven';
import type { NotifEventOneOfThreethree } from './notifEventOneOfThreethree';
@@ -51,4 +52,5 @@ export type NotifEvent =
| NotifEventOneOfThreeone
| NotifEventOneOfThreethree
| NotifEventOneOfThreefive
- | NotifEventOneOfThreeseven;
+ | NotifEventOneOfThreeseven
+ | NotifEventOneOfThreenine;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenine.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenine.ts
index 3ef7c4f28e..df93c54a2b 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenine.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenine.ts
@@ -4,14 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { InboxReauthRequiredMetadata } from './inboxReauthRequiredMetadata';
+import type { NewEmailMetadata } from './newEmailMetadata';
import type { NotifEventOneOfOnenineTag } from './notifEventOneOfOnenineTag';
/**
- * A linked inbox's grant died and must be reconnected.
+ * A new email has been sent to the user.
*/
export type NotifEventOneOfOnenine = {
- /** A linked inbox's grant died and must be reconnected. */
- content: InboxReauthRequiredMetadata;
+ /** A new email has been sent to the user. */
+ content: NewEmailMetadata;
tag: NotifEventOneOfOnenineTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenineTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenineTag.ts
index e41ba845d4..80761e9b85 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenineTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnenineTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfOnenineTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfOnenineTag = {
- inbox_reauth_required: 'inbox_reauth_required',
+ new_email: 'new_email',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOneseven.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOneseven.ts
index c24053ffed..90d72e202e 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOneseven.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOneseven.ts
@@ -4,14 +4,20 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { NewEmailMetadata } from './newEmailMetadata';
+import type { CallStartedMetadata } from './callStartedMetadata';
import type { NotifEventOneOfOnesevenTag } from './notifEventOneOfOnesevenTag';
/**
- * A new email has been sent to the user.
+ * A call has started in a channel the user is a member of.
+
+The `call-started` alias keeps rows persisted before the type name
+was normalized to snake_case (`call_started`) deserializable.
*/
export type NotifEventOneOfOneseven = {
- /** A new email has been sent to the user. */
- content: NewEmailMetadata;
+ /** A call has started in a channel the user is a member of.
+
+The `call-started` alias keeps rows persisted before the type name
+was normalized to snake_case (`call_started`) deserializable. */
+ content: CallStartedMetadata;
tag: NotifEventOneOfOnesevenTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnesevenTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnesevenTag.ts
index a3d09758f0..f9d99da3bb 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnesevenTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfOnesevenTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfOnesevenTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfOnesevenTag = {
- new_email: 'new_email',
+ call_started: 'call_started',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefive.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefive.ts
index 01f67b7f1b..d8a2974a89 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefive.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefive.ts
@@ -4,14 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { GithubPrMention } from './githubPrMention';
+import type { GithubPrComment } from './githubPrComment';
import type { NotifEventOneOfThreefiveTag } from './notifEventOneOfThreefiveTag';
/**
- * The user was mentioned on a GitHub pull request.
+ * A GitHub pull request was commented on.
*/
export type NotifEventOneOfThreefive = {
- /** The user was mentioned on a GitHub pull request. */
- content: GithubPrMention;
+ /** A GitHub pull request was commented on. */
+ content: GithubPrComment;
tag: NotifEventOneOfThreefiveTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefiveTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefiveTag.ts
index 619cb0f93d..c37e9455bb 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefiveTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreefiveTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfThreefiveTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfThreefiveTag = {
- github_pr_mention: 'github_pr_mention',
+ github_pr_comment: 'github_pr_comment',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreenine.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreenine.ts
new file mode 100644
index 0000000000..a047607e0e
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreenine.ts
@@ -0,0 +1,17 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { GithubPrReview } from './githubPrReview';
+import type { NotifEventOneOfThreenineTag } from './notifEventOneOfThreenineTag';
+
+/**
+ * A review was submitted on the user's GitHub pull request.
+ */
+export type NotifEventOneOfThreenine = {
+ /** A review was submitted on the user's GitHub pull request. */
+ content: GithubPrReview;
+ tag: NotifEventOneOfThreenineTag;
+};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreenineTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreenineTag.ts
new file mode 100644
index 0000000000..99744b055a
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreenineTag.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type NotifEventOneOfThreenineTag =
+ (typeof NotifEventOneOfThreenineTag)[keyof typeof NotifEventOneOfThreenineTag];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const NotifEventOneOfThreenineTag = {
+ github_pr_review: 'github_pr_review',
+} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeone.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeone.ts
index 085632a135..8f5e3836b5 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeone.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeone.ts
@@ -4,14 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { GithubReviewRequested } from './githubReviewRequested';
+import type { GithubPrCheckRun } from './githubPrCheckRun';
import type { NotifEventOneOfThreeoneTag } from './notifEventOneOfThreeoneTag';
/**
- * The user's review was requested on a GitHub pull request.
+ * A GitHub pull request check run completed.
*/
export type NotifEventOneOfThreeone = {
- /** The user's review was requested on a GitHub pull request. */
- content: GithubReviewRequested;
+ /** A GitHub pull request check run completed. */
+ content: GithubPrCheckRun;
tag: NotifEventOneOfThreeoneTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeoneTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeoneTag.ts
index 96a671da8a..770eac2aa1 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeoneTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeoneTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfThreeoneTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfThreeoneTag = {
- github_review_requested: 'github_review_requested',
+ github_pr_check_run: 'github_pr_check_run',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeseven.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeseven.ts
index 27c9e0da8b..bd91373448 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeseven.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreeseven.ts
@@ -4,14 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { GithubPrReview } from './githubPrReview';
+import type { GithubPrMention } from './githubPrMention';
import type { NotifEventOneOfThreesevenTag } from './notifEventOneOfThreesevenTag';
/**
- * A review was submitted on the user's GitHub pull request.
+ * The user was mentioned on a GitHub pull request.
*/
export type NotifEventOneOfThreeseven = {
- /** A review was submitted on the user's GitHub pull request. */
- content: GithubPrReview;
+ /** The user was mentioned on a GitHub pull request. */
+ content: GithubPrMention;
tag: NotifEventOneOfThreesevenTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreesevenTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreesevenTag.ts
index 1c9bc6bd40..6b6310db4c 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreesevenTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreesevenTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfThreesevenTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfThreesevenTag = {
- github_pr_review: 'github_pr_review',
+ github_pr_mention: 'github_pr_mention',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethree.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethree.ts
index c120361b96..e275efc12b 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethree.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethree.ts
@@ -4,14 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { GithubPrComment } from './githubPrComment';
+import type { GithubReviewRequested } from './githubReviewRequested';
import type { NotifEventOneOfThreethreeTag } from './notifEventOneOfThreethreeTag';
/**
- * A GitHub pull request was commented on.
+ * The user's review was requested on a GitHub pull request.
*/
export type NotifEventOneOfThreethree = {
- /** A GitHub pull request was commented on. */
- content: GithubPrComment;
+ /** The user's review was requested on a GitHub pull request. */
+ content: GithubReviewRequested;
tag: NotifEventOneOfThreethreeTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethreeTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethreeTag.ts
index 6a17ad6df1..56736f6ffe 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethreeTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfThreethreeTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfThreethreeTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfThreethreeTag = {
- github_pr_comment: 'github_pr_comment',
+ github_review_requested: 'github_review_requested',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofive.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofive.ts
index b027f731fc..566806c45b 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofive.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofive.ts
@@ -4,14 +4,15 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { AiResponseMetadata } from './aiResponseMetadata';
+
import type { NotifEventOneOfTwofiveTag } from './notifEventOneOfTwofiveTag';
+import type { TaskAssignedMetadata } from './taskAssignedMetadata';
/**
- * An AI assistant responded to a chat.
+ * A user was assigned to a task.
*/
export type NotifEventOneOfTwofive = {
- /** An AI assistant responded to a chat. */
- content: AiResponseMetadata;
+ /** A user was assigned to a task. */
+ content: TaskAssignedMetadata;
tag: NotifEventOneOfTwofiveTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofiveTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofiveTag.ts
index b78286bcb6..97b2d91afd 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofiveTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwofiveTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfTwofiveTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfTwofiveTag = {
- ai_response: 'ai_response',
+ task_assigned: 'task_assigned',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonine.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonine.ts
index 701a8926a7..d8689b03a9 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonine.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonine.ts
@@ -4,14 +4,20 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { GithubPrCheckRun } from './githubPrCheckRun';
+import type { GithubPrStatusChanged } from './githubPrStatusChanged';
import type { NotifEventOneOfTwonineTag } from './notifEventOneOfTwonineTag';
/**
- * A GitHub pull request check run completed.
+ * A GitHub pull request changed lifecycle state.
+
+The `github_pr_event` alias keeps rows and queue messages persisted
+before the rename deserializable.
*/
export type NotifEventOneOfTwonine = {
- /** A GitHub pull request check run completed. */
- content: GithubPrCheckRun;
+ /** A GitHub pull request changed lifecycle state.
+
+The `github_pr_event` alias keeps rows and queue messages persisted
+before the rename deserializable. */
+ content: GithubPrStatusChanged;
tag: NotifEventOneOfTwonineTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonineTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonineTag.ts
index dabc28ebb4..de1d24335d 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonineTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwonineTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfTwonineTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfTwonineTag = {
- github_pr_check_run: 'github_pr_check_run',
+ github_pr_status_changed: 'github_pr_status_changed',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoone.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoone.ts
index b84a9432ed..76539c2696 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoone.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoone.ts
@@ -4,14 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { InviteToTeamMetadata } from './inviteToTeamMetadata';
+import type { InboxReauthRequiredMetadata } from './inboxReauthRequiredMetadata';
import type { NotifEventOneOfTwooneTag } from './notifEventOneOfTwooneTag';
/**
- * A user was invited to a team.
+ * A linked inbox's grant died and must be reconnected.
*/
export type NotifEventOneOfTwoone = {
- /** A user was invited to a team. */
- content: InviteToTeamMetadata;
+ /** A linked inbox's grant died and must be reconnected. */
+ content: InboxReauthRequiredMetadata;
tag: NotifEventOneOfTwooneTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwooneTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwooneTag.ts
index 9e63689b83..71c25d7226 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwooneTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwooneTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfTwooneTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfTwooneTag = {
- invite_to_team: 'invite_to_team',
+ inbox_reauth_required: 'inbox_reauth_required',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoseven.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoseven.ts
index 9811a860ce..572e486a27 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoseven.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwoseven.ts
@@ -4,20 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { GithubPrStatusChanged } from './githubPrStatusChanged';
+import type { AiResponseMetadata } from './aiResponseMetadata';
import type { NotifEventOneOfTwosevenTag } from './notifEventOneOfTwosevenTag';
/**
- * A GitHub pull request changed lifecycle state.
-
-The `github_pr_event` alias keeps rows and queue messages persisted
-before the rename deserializable.
+ * An AI assistant responded to a chat.
*/
export type NotifEventOneOfTwoseven = {
- /** A GitHub pull request changed lifecycle state.
-
-The `github_pr_event` alias keeps rows and queue messages persisted
-before the rename deserializable. */
- content: GithubPrStatusChanged;
+ /** An AI assistant responded to a chat. */
+ content: AiResponseMetadata;
tag: NotifEventOneOfTwosevenTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwosevenTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwosevenTag.ts
index 0e4d656709..8a0edc14dc 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwosevenTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwosevenTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfTwosevenTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfTwosevenTag = {
- github_pr_status_changed: 'github_pr_status_changed',
+ ai_response: 'ai_response',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothree.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothree.ts
index 35ccbdb4cb..0200e7d904 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothree.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothree.ts
@@ -4,15 +4,14 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-
+import type { InviteToTeamMetadata } from './inviteToTeamMetadata';
import type { NotifEventOneOfTwothreeTag } from './notifEventOneOfTwothreeTag';
-import type { TaskAssignedMetadata } from './taskAssignedMetadata';
/**
- * A user was assigned to a task.
+ * A user was invited to a team.
*/
export type NotifEventOneOfTwothree = {
- /** A user was assigned to a task. */
- content: TaskAssignedMetadata;
+ /** A user was invited to a team. */
+ content: InviteToTeamMetadata;
tag: NotifEventOneOfTwothreeTag;
};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothreeTag.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothreeTag.ts
index c1c0444fa5..4f4d0a2012 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothreeTag.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notifEventOneOfTwothreeTag.ts
@@ -10,5 +10,5 @@ export type NotifEventOneOfTwothreeTag =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const NotifEventOneOfTwothreeTag = {
- task_assigned: 'task_assigned',
+ invite_to_team: 'invite_to_team',
} as const;
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 9c3b481e83..b5d20556f2 100644
--- a/js/app/packages/service-clients/service-notification/generated/zod.ts
+++ b/js/app/packages/service-clients/service-notification/generated/zod.ts
@@ -535,6 +535,31 @@ export const listTypedNotificationsResponse = zod
.describe(
'Someone replied to a thread in a channel that the user is part of.'
),
+ zod
+ .object({
+ content: zod
+ .object({
+ channel_name: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The name of the channel the call started in, when available.'
+ ),
+ sender_profile_picture_url: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Profile picture URL of the user who started the call, when available.'
+ ),
+ })
+ .describe(
+ 'Metadata for a notification that a call has started in a channel.\n\nMirrors the producer-side `CallStartedNotification` in the `call` crate:\nboth serialize the same wire shape (snake_case fields) under the same\n`call_started` [`Notification::TYPE_NAME`]. This type is the read-side\nmodel used by [`crate::NotifEvent`]; the producer keeps its own type\nbecause it additionally builds the incoming-call APNS\/VoIP push.\n\nRows persisted before the type name was normalized used the kebab-case\n`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a\n`#[serde(alias = \"call-started\")]` so those rows still deserialize.'
+ ),
+ tag: zod.enum(['call_started']),
+ })
+ .describe(
+ 'A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable.'
+ ),
zod
.object({
content: zod.object({
@@ -1770,6 +1795,31 @@ export const bulkGetTypedNotificationsByEventItemIdsResponse = zod
.describe(
'Someone replied to a thread in a channel that the user is part of.'
),
+ zod
+ .object({
+ content: zod
+ .object({
+ channel_name: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The name of the channel the call started in, when available.'
+ ),
+ sender_profile_picture_url: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Profile picture URL of the user who started the call, when available.'
+ ),
+ })
+ .describe(
+ 'Metadata for a notification that a call has started in a channel.\n\nMirrors the producer-side `CallStartedNotification` in the `call` crate:\nboth serialize the same wire shape (snake_case fields) under the same\n`call_started` [`Notification::TYPE_NAME`]. This type is the read-side\nmodel used by [`crate::NotifEvent`]; the producer keeps its own type\nbecause it additionally builds the incoming-call APNS\/VoIP push.\n\nRows persisted before the type name was normalized used the kebab-case\n`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a\n`#[serde(alias = \"call-started\")]` so those rows still deserialize.'
+ ),
+ tag: zod.enum(['call_started']),
+ })
+ .describe(
+ 'A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable.'
+ ),
zod
.object({
content: zod.object({
@@ -2999,6 +3049,31 @@ export const getTypedNotificationsByEventItemIdResponse = zod
.describe(
'Someone replied to a thread in a channel that the user is part of.'
),
+ zod
+ .object({
+ content: zod
+ .object({
+ channel_name: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The name of the channel the call started in, when available.'
+ ),
+ sender_profile_picture_url: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Profile picture URL of the user who started the call, when available.'
+ ),
+ })
+ .describe(
+ 'Metadata for a notification that a call has started in a channel.\n\nMirrors the producer-side `CallStartedNotification` in the `call` crate:\nboth serialize the same wire shape (snake_case fields) under the same\n`call_started` [`Notification::TYPE_NAME`]. This type is the read-side\nmodel used by [`crate::NotifEvent`]; the producer keeps its own type\nbecause it additionally builds the incoming-call APNS\/VoIP push.\n\nRows persisted before the type name was normalized used the kebab-case\n`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a\n`#[serde(alias = \"call-started\")]` so those rows still deserialize.'
+ ),
+ tag: zod.enum(['call_started']),
+ })
+ .describe(
+ 'A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable.'
+ ),
zod
.object({
content: zod.object({
@@ -4213,6 +4288,31 @@ export const getTypedNotificationByIdResponse = zod
.describe(
'Someone replied to a thread in a channel that the user is part of.'
),
+ zod
+ .object({
+ content: zod
+ .object({
+ channel_name: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The name of the channel the call started in, when available.'
+ ),
+ sender_profile_picture_url: zod
+ .string()
+ .nullish()
+ .describe(
+ 'Profile picture URL of the user who started the call, when available.'
+ ),
+ })
+ .describe(
+ 'Metadata for a notification that a call has started in a channel.\n\nMirrors the producer-side `CallStartedNotification` in the `call` crate:\nboth serialize the same wire shape (snake_case fields) under the same\n`call_started` [`Notification::TYPE_NAME`]. This type is the read-side\nmodel used by [`crate::NotifEvent`]; the producer keeps its own type\nbecause it additionally builds the incoming-call APNS\/VoIP push.\n\nRows persisted before the type name was normalized used the kebab-case\n`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a\n`#[serde(alias = \"call-started\")]` so those rows still deserialize.'
+ ),
+ tag: zod.enum(['call_started']),
+ })
+ .describe(
+ 'A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable.'
+ ),
zod
.object({
content: zod.object({
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index 2cc31bdba3..171ce76312 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1103,6 +1103,20 @@
}
}
},
+ "CallStartedMetadata": {
+ "type": "object",
+ "description": "Metadata for a notification that a call has started in a channel.\n\nMirrors the producer-side `CallStartedNotification` in the `call` crate:\nboth serialize the same wire shape (snake_case fields) under the same\n`call_started` [`Notification::TYPE_NAME`]. This type is the read-side\nmodel used by [`crate::NotifEvent`]; the producer keeps its own type\nbecause it additionally builds the incoming-call APNS/VoIP push.\n\nRows persisted before the type name was normalized used the kebab-case\n`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a\n`#[serde(alias = \"call-started\")]` so those rows still deserialize.",
+ "properties": {
+ "channel_name": {
+ "type": ["string", "null"],
+ "description": "The name of the channel the call started in, when available."
+ },
+ "sender_profile_picture_url": {
+ "type": ["string", "null"],
+ "description": "Profile picture URL of the user who started the call, when available."
+ }
+ }
+ },
"ChannelInviteMetadata": {
"type": "object",
"description": "Metadata for when a user is invited to a channel.",
@@ -2130,6 +2144,21 @@
}
}
},
+ {
+ "type": "object",
+ "description": "A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable.",
+ "required": ["content", "tag"],
+ "properties": {
+ "content": {
+ "$ref": "#/components/schemas/CallStartedMetadata",
+ "description": "A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable."
+ },
+ "tag": {
+ "type": "string",
+ "enum": ["call_started"]
+ }
+ }
+ },
{
"type": "object",
"description": "A new email has been sent to the user.",
diff --git a/rust/cloud-storage/call/src/domain/service.rs b/rust/cloud-storage/call/src/domain/service.rs
index 77efda4e70..e534c37dea 100644
--- a/rust/cloud-storage/call/src/domain/service.rs
+++ b/rust/cloud-storage/call/src/domain/service.rs
@@ -329,6 +329,11 @@ fn exclude_voip_recipients<'a>(
.collect()
}
+/// Producer-side payload for the "call started" notification.
+///
+/// Shares its wire shape and [`Notification::TYPE_NAME`] (`call_started`) with
+/// the read-side `model_notifications::CallStartedMetadata`, which
+/// `NotifEvent` uses to render the notification feed. Keep the two in sync.
#[derive(Serialize, Deserialize, Clone)]
struct CallStartedNotification {
sender_profile_picture_url: Option<String>,
@@ -336,7 +341,7 @@ struct CallStartedNotification {
}
impl Notification for CallStartedNotification {
- const TYPE_NAME: &'static str = "call-started";
+ const TYPE_NAME: &'static str = "call_started";
}
impl NotificationExtIos for CallStartedNotification {
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260618152324_rename_call_started_notification_type.sql b/rust/cloud-storage/macro_db_client/migrations/20260618152324_rename_call_started_notification_type.sql
new file mode 100644
index 0000000000..d0f3d0a376
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260618152324_rename_call_started_notification_type.sql
@@ -0,0 +1,16 @@
+-- The call-started notification type was normalized to snake_case
+-- (`call_started`) so it matches every other notification type and the
+-- `define_notif_event!` invariant (TYPE_NAME == snake_case of the NotifEvent
+-- variant). Rewrite persisted rows so stored notifications and per-type
+-- preferences keep working under the new tag.
+--
+-- The `NotifEvent::CallStarted` variant also carries a
+-- `#[serde(alias = "call-started")]`, so rows written during the deploy
+-- window still deserialize even before this migration runs.
+UPDATE notification
+SET notification_event_type = 'call_started'
+WHERE notification_event_type = 'call-started';
+
+UPDATE user_notification_type_preference
+SET notification_event_type = 'call_started'
+WHERE notification_event_type = 'call-started';
diff --git a/rust/cloud-storage/model_notifications/src/lib.rs b/rust/cloud-storage/model_notifications/src/lib.rs
index 5419dfe73c..a2740a6903 100644
--- a/rust/cloud-storage/model_notifications/src/lib.rs
+++ b/rust/cloud-storage/model_notifications/src/lib.rs
@@ -10,12 +10,12 @@ mod metadata;
mod unsubscribe;
pub use device::DeviceType;
pub use metadata::{
- AiResponseMetadata, ChannelInviteMetadata, ChannelMentionMetadata, ChannelMessageSendMetadata,
- ChannelReplyMetadata, ChannelType, CommentedOnDocumentMetadata, CommonChannelMetadata,
- DocumentMentionMetadata, GithubPrCheckRun, GithubPrCheckRunState, GithubPrComment,
- GithubPrCommentKind, GithubPrEventAction, GithubPrEventStatus, GithubPrMention,
- GithubPrMentionLocation, GithubPrNotificationCommon, GithubPrReview, GithubPrReviewState,
- GithubPrStatusChanged, GithubReviewRequested, InboxReauthRequiredMetadata,
+ AiResponseMetadata, CallStartedMetadata, ChannelInviteMetadata, ChannelMentionMetadata,
+ ChannelMessageSendMetadata, ChannelReplyMetadata, ChannelType, CommentedOnDocumentMetadata,
+ CommonChannelMetadata, DocumentMentionMetadata, GithubPrCheckRun, GithubPrCheckRunState,
+ GithubPrComment, GithubPrCommentKind, GithubPrEventAction, GithubPrEventStatus,
+ GithubPrMention, GithubPrMentionLocation, GithubPrNotificationCommon, GithubPrReview,
+ GithubPrReviewState, GithubPrStatusChanged, GithubReviewRequested, InboxReauthRequiredMetadata,
InviteToTeamMetadata, ItemSharedMetadata, MentionedInDocumentCommentMetadata, NewEmailMetadata,
NotificationDocumentSubType, NotificationTitle, RepliedToDocumentCommentThreadMetadata,
TaskAssignedMetadata,
@@ -193,6 +193,13 @@ define_notif_event!(
/// Someone replied to a thread in a channel that the user is part of.
ChannelMessageReply(ChannelReplyMetadata),
+ /// A call has started in a channel the user is a member of.
+ ///
+ /// The `call-started` alias keeps rows persisted before the type name
+ /// was normalized to snake_case (`call_started`) deserializable.
+ #[serde(alias = "call-started")]
+ CallStarted(CallStartedMetadata),
+
/// A new email has been sent to the user.
NewEmail(NewEmailMetadata),
@@ -256,6 +263,9 @@ impl NotificationTitle for NotifEvent {
NotifEvent::ChannelMessageReply(channel_reply_metadata) => {
channel_reply_metadata.format_title(sender_id)
}
+ NotifEvent::CallStarted(call_started_metadata) => {
+ call_started_metadata.format_title(sender_id)
+ }
NotifEvent::NewEmail(new_email_metadata) => new_email_metadata.format_title(sender_id),
NotifEvent::InboxReauthRequired(m) => m.format_title(sender_id),
NotifEvent::InviteToTeam(_) => Err(report!("not implemented")),
@@ -309,6 +319,9 @@ impl NotificationTitle for NotifEvent {
NotifEvent::ChannelMessageReply(channel_reply_metadata) => {
channel_reply_metadata.format_body(sender_id)
}
+ NotifEvent::CallStarted(call_started_metadata) => {
+ call_started_metadata.format_body(sender_id)
+ }
NotifEvent::NewEmail(new_email_metadata) => new_email_metadata.format_body(sender_id),
NotifEvent::InboxReauthRequired(m) => m.format_body(sender_id),
NotifEvent::InviteToTeam(_) => Err(report!("not implemented")),
diff --git a/rust/cloud-storage/model_notifications/src/metadata.rs b/rust/cloud-storage/model_notifications/src/metadata.rs
index 4f98404078..9b7940627c 100644
--- a/rust/cloud-storage/model_notifications/src/metadata.rs
+++ b/rust/cloud-storage/model_notifications/src/metadata.rs
@@ -1282,3 +1282,48 @@ impl NotificationExtIos for CommentedOnDocumentMetadata {
alert_apns(self, sender_id, notification_id, profile_pic).ok()
}
}
+
+/// Metadata for a notification that a call has started in a channel.
+///
+/// Mirrors the producer-side `CallStartedNotification` in the `call` crate:
+/// both serialize the same wire shape (snake_case fields) under the same
+/// `call_started` [`Notification::TYPE_NAME`]. This type is the read-side
+/// model used by [`crate::NotifEvent`]; the producer keeps its own type
+/// because it additionally builds the incoming-call APNS/VoIP push.
+///
+/// Rows persisted before the type name was normalized used the kebab-case
+/// `call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a
+/// `#[serde(alias = "call-started")]` so those rows still deserialize.
+#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]
+pub struct CallStartedMetadata {
+ /// The name of the channel the call started in, when available.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub channel_name: Option<String>,
+ /// Profile picture URL of the user who started the call, when available.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub sender_profile_picture_url: Option<String>,
+}
+
+impl Notification for CallStartedMetadata {
+ const TYPE_NAME: &'static str = "call_started";
+}
+
+impl NotificationTitle for CallStartedMetadata {
+ fn format_title(
+ &self,
+ sender_id: Option<MacroUserIdStr<'_>>,
+ ) -> Result<String, rootcause::Report> {
+ let title = match sender_id {
+ Some(sender) => format!("{} started a call", sender.email_part().local_part()),
+ None => "Call started".to_string(),
+ };
+ Ok(title)
+ }
+
+ fn format_body(
+ &self,
+ _sender_id: Option<MacroUserIdStr<'_>>,
+ ) -> Result<String, rootcause::Report> {
+ Ok(self.channel_name.clone().unwrap_or_default())
+ }
+}
diff --git a/rust/cloud-storage/model_notifications/src/metadata/test.rs b/rust/cloud-storage/model_notifications/src/metadata/test.rs
index c3ba81a31c..a47cb8d344 100644
--- a/rust/cloud-storage/model_notifications/src/metadata/test.rs
+++ b/rust/cloud-storage/model_notifications/src/metadata/test.rs
@@ -598,3 +598,60 @@ fn channel_message_send_bot_json_serializes_explicit_null_sender_and_round_trips
Some("Helper Bot")
);
}
+
+#[test]
+fn call_started_tagged_content_serializes_with_snake_case_type_name() {
+ let event = CallStartedMetadata {
+ channel_name: Some("general".to_string()),
+ sender_profile_picture_url: Some("https://example.com/pic.png".to_string()),
+ };
+
+ let value =
+ serde_json::to_value(notification::domain::models::TaggedContent::new(event)).unwrap();
+
+ assert_eq!(value["tag"], "call_started");
+ assert_eq!(value["content"]["channel_name"], "general");
+ assert_eq!(
+ value["content"]["sender_profile_picture_url"],
+ "https://example.com/pic.png"
+ );
+}
+
+#[test]
+fn call_started_notif_event_deserializes_and_renders_in_app() {
+ let value = serde_json::json!({
+ "tag": "call_started",
+ "content": { "channel_name": "general" },
+ });
+
+ let event: crate::NotifEvent = serde_json::from_value(value).unwrap();
+
+ assert_eq!(
+ event
+ .format_title(Some(uid("macro|[email protected]")))
+ .unwrap(),
+ "caller started a call"
+ );
+ assert_eq!(event.format_body(None).unwrap(), "general");
+
+ let crate::NotifEvent::CallStarted(actual) = event else {
+ panic!("expected call_started variant");
+ };
+ assert_eq!(actual.channel_name.as_deref(), Some("general"));
+}
+
+#[test]
+fn call_started_deserializes_from_legacy_kebab_case_tag() {
+ // Rows persisted before the rename used the kebab-case `call-started`.
+ let value = serde_json::json!({
+ "tag": "call-started",
+ "content": { "channel_name": "general" },
+ });
+
+ let event: crate::NotifEvent = serde_json::from_value(value).unwrap();
+
+ let crate::NotifEvent::CallStarted(actual) = event else {
+ panic!("expected call_started variant from legacy tag");
+ };
+ assert_eq!(actual.channel_name.as_deref(), Some("general"));
+}