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.

chore(entity): remove email entity type (#1760)

Sean Aye43429af70a15
diff --git a/js/app/packages/core/component/GlobalNotificationBell.tsx b/js/app/packages/core/component/GlobalNotificationBell.tsx
index a66b2099d6..ac28f79e4e 100644
--- a/js/app/packages/core/component/GlobalNotificationBell.tsx
+++ b/js/app/packages/core/component/GlobalNotificationBell.tsx
@@ -22,9 +22,7 @@ export function GlobalNotificationBell(props: GlobalNotificationBellProps) {
const notificationSource = useGlobalNotificationSource();
const unreadNotifications = () =>
- allUnreadNotifications().filter(
- (n) => !n.done && n.entity_type !== 'email'
- );
+ allUnreadNotifications().filter((n) => !n.done);
const unreadCount = () => unreadNotifications().length;
diff --git a/js/app/packages/notifications/tests/notification-preview.test.ts b/js/app/packages/notifications/tests/notification-preview.test.ts
index 402b5e3935..c1f9d79440 100644
--- a/js/app/packages/notifications/tests/notification-preview.test.ts
+++ b/js/app/packages/notifications/tests/notification-preview.test.ts
@@ -8,7 +8,7 @@ function createEmailNotification(
return {
id: 'notif-1',
entity_id: 'thread-1',
- entity_type: 'email',
+ entity_type: 'email_thread',
created_at: new Date().toISOString(),
updated_at: null,
viewed_at: null,
diff --git a/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts b/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts
index 3ea163c3c4..4a984ebf8f 100644
--- a/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts
+++ b/js/app/packages/service-clients/service-connection/generated/schemas/entityType.ts
@@ -17,7 +17,6 @@ export const EntityType = {
channel: 'channel',
document: 'document',
project: 'project',
- email: 'email',
email_thread: 'email_thread',
team: 'team',
} as const;
diff --git a/js/app/packages/service-clients/service-connection/openapi.json b/js/app/packages/service-clients/service-connection/openapi.json
index 3a855b6c13..781df600fe 100644
--- a/js/app/packages/service-clients/service-connection/openapi.json
+++ b/js/app/packages/service-clients/service-connection/openapi.json
@@ -234,7 +234,6 @@
"channel",
"document",
"project",
- "email",
"email_thread",
"team"
]
diff --git a/js/app/packages/service-clients/service-connection/stream-events.ts b/js/app/packages/service-clients/service-connection/stream-events.ts
index ff5d88cd56..7f84818e3d 100644
--- a/js/app/packages/service-clients/service-connection/stream-events.ts
+++ b/js/app/packages/service-clients/service-connection/stream-events.ts
@@ -1,8 +1,9 @@
import type { Accessor } from 'solid-js';
import { createStore } from 'solid-js/store';
-import type { EntityType, StreamEvent } from './generated/schemas';
+import type { StreamEvent } from './generated/schemas';
import { isStreamEntity } from './stream';
import { createConnectionWebsocketEffect, ws } from './websocket';
+import type { EntityData } from '@entity';
const [streamState, setStreamState] = createStore<Record<string, StreamEvent>>(
{}
@@ -27,7 +28,7 @@ export function getStreamState(
export function subscribeToStreamState(
entity_id: string,
- entity_type: EntityType
+ entity_type: EntityData['type']
) {
if (!isStreamEntity(entity_type) || subscribed.has(entity_id)) return;
subscribed.add(entity_id);
diff --git a/js/app/packages/service-clients/service-connection/stream.ts b/js/app/packages/service-clients/service-connection/stream.ts
index 845972e85a..be98e5ff63 100644
--- a/js/app/packages/service-clients/service-connection/stream.ts
+++ b/js/app/packages/service-clients/service-connection/stream.ts
@@ -3,15 +3,15 @@ import type { Accessor, Setter } from 'solid-js';
import { createSignal } from 'solid-js';
import { createStore, produce } from 'solid-js/store';
import { match } from 'ts-pattern';
-import type { EntityType } from './generated/schemas';
import { createConnectionWebsocketEffect } from './websocket';
+import type { EntityData } from '@entity';
// entities that support streaming
export type StreamType = {
chat: ChatStream;
};
export function isStreamEntity(
- entity_type: EntityType
+ entity_type: EntityData['type']
): entity_type is keyof StreamType {
return entity_type === 'chat';
}
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts b/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts
index 4a5c324a24..825bc35002 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/entityType.ts
@@ -17,7 +17,6 @@ export const EntityType = {
channel: 'channel',
document: 'document',
project: 'project',
- email: 'email',
email_thread: 'email_thread',
team: 'team',
} as const;
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index c5ce1ee422..b81c57fa41 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1268,7 +1268,6 @@
"channel",
"document",
"project",
- "email",
"email_thread",
"team"
]
diff --git a/rust/cloud-storage/entity_access/src/domain/service.rs b/rust/cloud-storage/entity_access/src/domain/service.rs
index 0814a3d15f..5f14e48a06 100644
--- a/rust/cloud-storage/entity_access/src/domain/service.rs
+++ b/rust/cloud-storage/entity_access/src/domain/service.rs
@@ -125,7 +125,7 @@ where
}
EntityType::Channel => self.get_channel_access(entity_id, user_id).await,
// These entity types don't have access checks implemented yet
- EntityType::Email | EntityType::Team | EntityType::User => Ok(None),
+ EntityType::Team | EntityType::User => Ok(None),
}
}
diff --git a/rust/cloud-storage/entity_access/src/domain/service/test.rs b/rust/cloud-storage/entity_access/src/domain/service/test.rs
index 3084352a88..4cb67f6a26 100644
--- a/rust/cloud-storage/entity_access/src/domain/service/test.rs
+++ b/rust/cloud-storage/entity_access/src/domain/service/test.rs
@@ -278,12 +278,7 @@ async fn test_unsupported_entity_type_returns_none() {
let service = EntityAccessServiceImpl::new(repo);
let user_id = test_user_id();
- // Email, Team, and User entity types don't have access checks implemented
- let result = service
- .get_access_level(Some(&user_id), "email-1", EntityType::Email)
- .await;
- assert_eq!(result.unwrap(), None);
-
+ // Team, and User entity types don't have access checks implemented
let result = service
.get_access_level(Some(&user_id), "team-1", EntityType::Team)
.await;
@@ -409,7 +404,7 @@ async fn test_get_entity_permission_unsupported_type_returns_bad_request() {
let user_id = test_user_id();
let result = service
- .get_entity_permission(Some(&user_id), "email-1", EntityType::Email, None)
+ .get_entity_permission(Some(&user_id), "team-1", EntityType::Team, None)
.await;
assert!(matches!(result, Err(AccessError::BadRequest(_))));
@@ -763,8 +758,8 @@ async fn test_generate_receipt_unsupported_type_returns_bad_request() {
.generate_entity_access_receipt::<ViewAccessLevel>(
&user_id,
None,
- "email-1",
- EntityType::Email,
+ "team-1",
+ EntityType::Team,
)
.await;
diff --git a/rust/cloud-storage/model-entity/src/lib.rs b/rust/cloud-storage/model-entity/src/lib.rs
index 349afd0a23..86df3ae8ee 100644
--- a/rust/cloud-storage/model-entity/src/lib.rs
+++ b/rust/cloud-storage/model-entity/src/lib.rs
@@ -41,8 +41,6 @@ pub enum EntityType {
Document,
/// The entity is a collection of other entities
Project,
- /// The entity is an email
- Email,
/// The entity is an email thread
EmailThread,
/// The entity is a team