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(notif): document mention push notificaiton opens message (#3257)

Sean Ayedade8215ba1b
diff --git a/js/app/packages/entity/mocks/mockEntityData.ts b/js/app/packages/entity/mocks/mockEntityData.ts
index 5a607808ac..a01cc0a5fb 100644
--- a/js/app/packages/entity/mocks/mockEntityData.ts
+++ b/js/app/packages/entity/mocks/mockEntityData.ts
@@ -141,7 +141,13 @@ export const createMockNotification = (
viewed_at: null,
notification_metadata: {
tag: 'document_mention',
- content: { documentName: 'Test Document', owner: 'user_123' },
+ content: {
+ channelType: 'private',
+ documentName: 'Test Document',
+ messageContent: 'Test message',
+ messageId: 'message_123',
+ owner: 'user_123',
+ },
},
...overrides,
});
diff --git a/js/app/packages/notifications/notification-navigation.ts b/js/app/packages/notifications/notification-navigation.ts
index 5519462fca..5e7815ca65 100644
--- a/js/app/packages/notifications/notification-navigation.ts
+++ b/js/app/packages/notifications/notification-navigation.ts
@@ -192,13 +192,34 @@ function getSupportedHandler(
.with('document_mention', () => {
const meta = notification.notification_metadata;
if (meta.tag !== 'document_mention') return null;
- return async (lm: SplitManager, newSplit: boolean = false) =>
- openSplitIfNotOpen(
- lm,
- safeDocumentContentToBlockName(meta.content, entity),
- notification.entity_id,
- { newSplit }
- );
+
+ // Document mentions are generated by channel messages. For these
+ // notifications, open the source channel message rather than the
+ // mentioned document.
+ return async (lm: SplitManager, newSplit: boolean = false) => {
+ const content = meta.content;
+ const messageId = content.messageId;
+ const threadId = content.threadId ?? undefined;
+
+ if (messageId) {
+ const orchestrator = lm.getOrchestrator();
+ await navigateToChannelMessage(
+ orchestrator,
+ notification.entity_id,
+ messageId,
+ threadId,
+ {
+ splitManager: lm,
+ preferNewSplit: newSplit,
+ }
+ );
+ return;
+ }
+
+ openSplitIfNotOpen(lm, 'channel', notification.entity_id, {
+ newSplit,
+ });
+ };
})
.with('invite_to_team', () => null)
.with(
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadata.ts b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadata.ts
index 6f7fc80a3d..25d2c18e81 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadata.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadata.ts
@@ -4,20 +4,11 @@
* notification_service
* OpenAPI spec version: 0.1.0
*/
-import type { DocumentMentionMetadataFileType } from './documentMentionMetadataFileType';
-import type { DocumentMentionMetadataSenderProfilePictureUrl } from './documentMentionMetadataSenderProfilePictureUrl';
-import type { DocumentMentionMetadataSubType } from './documentMentionMetadataSubType';
+import type { ChannelMentionMetadata } from './channelMentionMetadata';
+import type { DocumentMentionMetadataAllOf } from './documentMentionMetadataAllOf';
/**
* Someone mentioned a document in a channel
*/
-export interface DocumentMentionMetadata {
- /** The name of the document */
- documentName: string;
- /** The file type of the document */
- fileType?: DocumentMentionMetadataFileType;
- /** The owner of the document */
- owner: string;
- senderProfilePictureUrl?: DocumentMentionMetadataSenderProfilePictureUrl;
- subType?: DocumentMentionMetadataSubType;
-}
+export type DocumentMentionMetadata = ChannelMentionMetadata &
+ DocumentMentionMetadataAllOf;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOf.ts b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOf.ts
new file mode 100644
index 0000000000..e9ac9abee6
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOf.ts
@@ -0,0 +1,18 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { DocumentMentionMetadataAllOfFileType } from './documentMentionMetadataAllOfFileType';
+import type { DocumentMentionMetadataAllOfSubType } from './documentMentionMetadataAllOfSubType';
+
+export type DocumentMentionMetadataAllOf = {
+ /** The name of the document */
+ documentName: string;
+ /** The file type of the document */
+ fileType?: DocumentMentionMetadataAllOfFileType;
+ /** The owner of the document */
+ owner: string;
+ subType?: DocumentMentionMetadataAllOfSubType;
+};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataFileType.ts b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOfFileType.ts
similarity index 71%
rename from js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataFileType.ts
rename to js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOfFileType.ts
index dc1f146049..7d2e272026 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataFileType.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOfFileType.ts
@@ -8,4 +8,4 @@
/**
* The file type of the document
*/
-export type DocumentMentionMetadataFileType = string | null;
+export type DocumentMentionMetadataAllOfFileType = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataSubType.ts b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOfSubType.ts
similarity index 70%
rename from js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataSubType.ts
rename to js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOfSubType.ts
index 7315c848d2..f9a1534851 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataSubType.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataAllOfSubType.ts
@@ -6,4 +6,5 @@
*/
import type { NotificationDocumentSubType } from './notificationDocumentSubType';
-export type DocumentMentionMetadataSubType = null | NotificationDocumentSubType;
+export type DocumentMentionMetadataAllOfSubType =
+ null | NotificationDocumentSubType;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataSenderProfilePictureUrl.ts b/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataSenderProfilePictureUrl.ts
deleted file mode 100644
index 33da27f154..0000000000
--- a/js/app/packages/service-clients/service-notification/generated/schemas/documentMentionMetadataSenderProfilePictureUrl.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * notification_service
- * OpenAPI spec version: 0.1.0
- */
-
-export type DocumentMentionMetadataSenderProfilePictureUrl = 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 6ccd977614..00986d100d 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
@@ -42,9 +42,9 @@ export * from './createNotificationAllOf';
export * from './deviceRequest';
export * from './deviceType';
export * from './documentMentionMetadata';
-export * from './documentMentionMetadataFileType';
-export * from './documentMentionMetadataSenderProfilePictureUrl';
-export * from './documentMentionMetadataSubType';
+export * from './documentMentionMetadataAllOf';
+export * from './documentMentionMetadataAllOfFileType';
+export * from './documentMentionMetadataAllOfSubType';
export * from './emptyResponse';
export * from './entity';
export * from './entityType';
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 643b9e053b..029a345c54 100644
--- a/js/app/packages/service-clients/service-notification/generated/zod.ts
+++ b/js/app/packages/service-clients/service-notification/generated/zod.ts
@@ -181,30 +181,59 @@ export const listTypedNotificationsResponse = zod
.object({
content: zod
.object({
- documentName: zod
- .string()
- .describe('The name of the document'),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document'),
- owner: zod
- .string()
- .describe('The owner of the document'),
- senderProfilePictureUrl: zod.string().nullish(),
- subType: zod
- .union([
- zod.null(),
- zod
- .object({
- type: zod.enum(['task']),
- })
- .describe(
- 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
- ),
- ])
- .optional(),
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
})
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ )
+ .and(
+ zod.object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod
+ .string()
+ .describe('The owner of the document'),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
+ ),
+ ])
+ .optional(),
+ })
+ )
.describe('Someone mentioned a document in a channel'),
tag: zod.enum(['document_mention']),
})
@@ -614,30 +643,59 @@ export const bulkGetTypedNotificationsByEventItemIdsResponse = zod
.object({
content: zod
.object({
- documentName: zod
- .string()
- .describe('The name of the document'),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document'),
- owner: zod
- .string()
- .describe('The owner of the document'),
- senderProfilePictureUrl: zod.string().nullish(),
- subType: zod
- .union([
- zod.null(),
- zod
- .object({
- type: zod.enum(['task']),
- })
- .describe(
- 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
- ),
- ])
- .optional(),
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
})
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ )
+ .and(
+ zod.object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod
+ .string()
+ .describe('The owner of the document'),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
+ ),
+ ])
+ .optional(),
+ })
+ )
.describe('Someone mentioned a document in a channel'),
tag: zod.enum(['document_mention']),
})
@@ -1041,30 +1099,59 @@ export const getTypedNotificationsByEventItemIdResponse = zod
.object({
content: zod
.object({
- documentName: zod
- .string()
- .describe('The name of the document'),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document'),
- owner: zod
- .string()
- .describe('The owner of the document'),
- senderProfilePictureUrl: zod.string().nullish(),
- subType: zod
- .union([
- zod.null(),
- zod
- .object({
- type: zod.enum(['task']),
- })
- .describe(
- 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
- ),
- ])
- .optional(),
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
})
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ )
+ .and(
+ zod.object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod
+ .string()
+ .describe('The owner of the document'),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
+ ),
+ ])
+ .optional(),
+ })
+ )
.describe('Someone mentioned a document in a channel'),
tag: zod.enum(['document_mention']),
})
@@ -1477,28 +1564,55 @@ export const getTypedNotificationByIdResponse = zod
.object({
content: zod
.object({
- documentName: zod
- .string()
- .describe('The name of the document'),
- fileType: zod
- .string()
- .nullish()
- .describe('The file type of the document'),
- owner: zod.string().describe('The owner of the document'),
- senderProfilePictureUrl: zod.string().nullish(),
- subType: zod
- .union([
- zod.null(),
- zod
- .object({
- type: zod.enum(['task']),
- })
- .describe(
- 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
- ),
- ])
- .optional(),
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
})
+ .describe('Common metadata for notifications on channels')
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ )
+ .and(
+ zod.object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod.string().describe('The owner of the document'),
+ subType: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ type: zod.enum(['task']),
+ })
+ .describe(
+ 'The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern.'
+ ),
+ ])
+ .optional(),
+ })
+ )
.describe('Someone mentioned a document in a channel'),
tag: zod.enum(['document_mention']),
})
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index bf00327002..78c2046923 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1391,37 +1391,41 @@
"enum": ["ios", "android", "iosvoip"]
},
"DocumentMentionMetadata": {
- "type": "object",
- "description": "Someone mentioned a document in a channel",
- "required": ["documentName", "owner"],
- "properties": {
- "documentName": {
- "type": "string",
- "description": "The name of the document"
- },
- "fileType": {
- "type": ["string", "null"],
- "description": "The file type of the document"
- },
- "owner": {
- "type": "string",
- "description": "The owner of the document"
- },
- "senderProfilePictureUrl": {
- "type": ["string", "null"]
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ChannelMentionMetadata"
},
- "subType": {
- "oneOf": [
- {
- "type": "null"
+ {
+ "type": "object",
+ "required": ["documentName", "owner"],
+ "properties": {
+ "documentName": {
+ "type": "string",
+ "description": "The name of the document"
+ },
+ "fileType": {
+ "type": ["string", "null"],
+ "description": "The file type of the document"
},
- {
- "$ref": "#/components/schemas/NotificationDocumentSubType",
- "description": "The sub type of the document (e.g. task)"
+ "owner": {
+ "type": "string",
+ "description": "The owner of the document"
+ },
+ "subType": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/NotificationDocumentSubType",
+ "description": "The sub type of the document (e.g. task)"
+ }
+ ]
}
- ]
+ }
}
- }
+ ],
+ "description": "Someone mentioned a document in a channel"
},
"EmptyResponse": {
"type": "object",
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/notification.rs b/rust/cloud-storage/comms_service/src/notification.rs
index 7fd11e144d..68d1dcba53 100644
--- a/rust/cloud-storage/comms_service/src/notification.rs
+++ b/rust/cloud-storage/comms_service/src/notification.rs
@@ -106,7 +106,16 @@ impl ChannelMessageEvent<'_> {
Some("task") => Some(NotificationDocumentSubType::Task),
_ => None,
},
- sender_profile_picture_url: self.sender_profile_picture_url.clone(),
+ channel: ChannelMentionMetadata {
+ message_content: self.message.content.clone(),
+ message_id: self.message.id.to_string(),
+ has_attachments: self.has_attachments,
+ thread_id: self.message.thread_id.map(|t| t.to_string()),
+ common: self.channel_metadata.clone(),
+ sender_profile_picture_url: self
+ .sender_profile_picture_url
+ .clone(),
+ },
},
sender_id: sender(),
recipient_ids: doc_recipients.clone(),
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260513193557_delete_outdated_notifs.sql b/rust/cloud-storage/macro_db_client/migrations/20260513193557_delete_outdated_notifs.sql
new file mode 100644
index 0000000000..8655cc5b40
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260513193557_delete_outdated_notifs.sql
@@ -0,0 +1,13 @@
+-- Add a general index for notification-type lookups/deletes. This keeps the
+-- cleanup below from scanning the entire notification table and is useful for
+-- future notification-type maintenance.
+--
+-- Note: macro_db_client migrations run inside a transaction, so this cannot use
+-- CREATE INDEX CONCURRENTLY.
+CREATE INDEX IF NOT EXISTS idx_notification_event_type
+ ON notification (notification_event_type);
+
+-- All existing document_mention notifications predate the required flattened
+-- ChannelMentionMetadata fields and will fail deserialization.
+DELETE FROM notification
+WHERE notification_event_type = 'document_mention';
diff --git a/rust/cloud-storage/model_notifications/src/metadata.rs b/rust/cloud-storage/model_notifications/src/metadata.rs
index 6514966290..501dbcf276 100644
--- a/rust/cloud-storage/model_notifications/src/metadata.rs
+++ b/rust/cloud-storage/model_notifications/src/metadata.rs
@@ -189,8 +189,8 @@ pub struct DocumentMentionMetadata {
#[serde(alias = "sub_type")]
#[serde(default)]
pub sub_type: Option<NotificationDocumentSubType>,
- #[serde(default)]
- pub sender_profile_picture_url: Option<String>,
+ #[serde(flatten)]
+ pub channel: ChannelMentionMetadata,
}
impl From<DocumentMentionMetadata> for serde_json::Value {
@@ -528,9 +528,8 @@ impl NotificationExtIos for ChannelReplyMetadata {
impl NotificationExtIos for DocumentMentionMetadata {
type NotifData = ::notification::domain::models::apple::PushNotificationData;
- fn collapse_key(&self, entity: &Entity<'_>) -> NotifCollapseKey {
- let entity_type: &'static str = entity.entity_type.into();
- NotifCollapseKey::new(entity_type).append(&entity.entity_id)
+ fn collapse_key(&self, _entity: &Entity<'_>) -> NotifCollapseKey {
+ NotifCollapseKey::new(&self.channel.message_id)
}
fn as_apns<'a>(
@@ -539,7 +538,7 @@ impl NotificationExtIos for DocumentMentionMetadata {
_entity: &Entity<'_>,
notification_id: Uuid,
) -> Option<APNSPushNotification<Self::NotifData>> {
- let profile_pic = self.sender_profile_picture_url.clone();
+ let profile_pic = self.channel.sender_profile_picture_url.clone();
alert_apns(self, sender_id, notification_id, profile_pic).ok()
}
}
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 7b069716f2..cfd99cdaf4 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
@@ -51,7 +51,11 @@ fn to_typed_row_channel_mention() {
#[test]
fn to_typed_row_document_mention() {
let metadata = serde_json::json!({
+ "channelName": "general",
+ "channelType": "Public",
"documentName": "doc.pdf",
+ "messageContent": "see doc.pdf",
+ "messageId": "msg-1",
"owner": "macro|[email protected]"
});
let row = make_row("document_mention", metadata);