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(calls): include customName in call preview (#3346)

teo6d77d3de1c87
diff --git a/js/app/packages/queries/preview/fetchers.ts b/js/app/packages/queries/preview/fetchers.ts
index bad5d275bd..2908d76568 100644
--- a/js/app/packages/queries/preview/fetchers.ts
+++ b/js/app/packages/queries/preview/fetchers.ts
@@ -134,15 +134,20 @@ async function fetchCallPreviews(ids: string[]): Promise<PreviewItem[]> {
} as const;
switch (call.type) {
- case 'exists':
+ case 'exists': {
+ // Match the call block (CallRecordingSplitHeader / CallRecordingBody):
+ // prefer the user-supplied / AI-generated `customName`, fall back to
+ // the channel the call lives in.
+ const displayName = call.customName ?? call.channelName;
return {
...base,
access: 'access' as const,
loading: false,
- rawName: call.channelName ?? '',
- name: call.channelName ?? 'Unknown Call',
+ rawName: displayName ?? '',
+ name: displayName ?? 'Unknown Call',
updatedAt: call.startedAt,
};
+ }
case 'does_not_exist':
return {
...base,
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewData.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewData.ts
index fbc834f7b3..7802952940 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewData.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewData.ts
@@ -5,6 +5,7 @@
* OpenAPI spec version: 0.1.0
*/
import type { CallRecordPreviewDataChannelName } from './callRecordPreviewDataChannelName';
+import type { CallRecordPreviewDataCustomName } from './callRecordPreviewDataCustomName';
import type { CallRecordPreviewDataEndedAt } from './callRecordPreviewDataEndedAt';
/**
@@ -17,6 +18,9 @@ export interface CallRecordPreviewData {
channelId: string;
/** Resolved display name for the channel. */
channelName?: CallRecordPreviewDataChannelName;
+ /** User-supplied or AI-generated display name for the call. Only set on
+archived `call_records`; active calls always return `None`. */
+ customName?: CallRecordPreviewDataCustomName;
/** When the call ended (None if still active). */
endedAt?: CallRecordPreviewDataEndedAt;
/** When the call started (created_at for active, started_at for archived). */
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewDataCustomName.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewDataCustomName.ts
new file mode 100644
index 0000000000..dacce605b4
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordPreviewDataCustomName.ts
@@ -0,0 +1,12 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * User-supplied or AI-generated display name for the call. Only set on
+archived `call_records`; active calls always return `None`.
+ */
+export type CallRecordPreviewDataCustomName = string | null;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
index c9aa81081b..cd0de28dbb 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
@@ -95,6 +95,7 @@ export * from './callRecordParticipantLeftAt';
export * from './callRecordPreview';
export * from './callRecordPreviewData';
export * from './callRecordPreviewDataChannelName';
+export * from './callRecordPreviewDataCustomName';
export * from './callRecordPreviewDataEndedAt';
export * from './callRecordPreviewOneOf';
export * from './callRecordPreviewOneOfAllOf';
diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.ts
index 9c5f1f4f23..ce59dffc8f 100644
--- a/js/app/packages/service-clients/service-storage/generated/zod.ts
+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts
@@ -849,6 +849,12 @@ export const getBatchCallRecordPreviewResponse = zod
.string()
.nullish()
.describe('Resolved display name for the channel.'),
+ customName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'User-supplied or AI-generated display name for the call. Only set on\narchived `call_records`; active calls always return `None`.'
+ ),
endedAt: zod.iso
.datetime({})
.nullish()
diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.json
index 01e7083a5a..fcb5960eac 100644
--- a/js/app/packages/service-clients/service-storage/openapi.json
+++ b/js/app/packages/service-clients/service-storage/openapi.json
@@ -6821,6 +6821,10 @@
"type": ["string", "null"],
"description": "Resolved display name for the channel."
},
+ "customName": {
+ "type": ["string", "null"],
+ "description": "User-supplied or AI-generated display name for the call. Only set on\narchived `call_records`; active calls always return `None`."
+ },
"endedAt": {
"type": ["string", "null"],
"format": "date-time",
diff --git a/rust/cloud-storage/.sqlx/query-3d13e3995ba4fb30b9e2df9b41a42099d88663620b9139706c54340e757a47fc.json b/rust/cloud-storage/.sqlx/query-c449c7237e08cf511f7bc2182d62e12e2aaff653c37f79cd3feb22ea4b849ea6.json
similarity index 54%
rename from rust/cloud-storage/.sqlx/query-3d13e3995ba4fb30b9e2df9b41a42099d88663620b9139706c54340e757a47fc.json
rename to rust/cloud-storage/.sqlx/query-c449c7237e08cf511f7bc2182d62e12e2aaff653c37f79cd3feb22ea4b849ea6.json
index 30a463452c..7f2a36f19f 100644
--- a/rust/cloud-storage/.sqlx/query-3d13e3995ba4fb30b9e2df9b41a42099d88663620b9139706c54340e757a47fc.json
+++ b/rust/cloud-storage/.sqlx/query-c449c7237e08cf511f7bc2182d62e12e2aaff653c37f79cd3feb22ea4b849ea6.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\"\n FROM calls\n WHERE id = ANY($1)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\"\n FROM call_records\n WHERE id = ANY($1)\n ",
+ "query": "\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::text as \"custom_name\"\n FROM calls\n WHERE id = ANY($1)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n custom_name as \"custom_name\"\n FROM call_records\n WHERE id = ANY($1)\n ",
"describe": {
"columns": [
{
@@ -22,6 +22,11 @@
"ordinal": 3,
"name": "ended_at",
"type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 4,
+ "name": "custom_name",
+ "type_info": "Text"
}
],
"parameters": {
@@ -33,8 +38,9 @@
null,
null,
null,
+ null,
null
]
},
- "hash": "3d13e3995ba4fb30b9e2df9b41a42099d88663620b9139706c54340e757a47fc"
+ "hash": "c449c7237e08cf511f7bc2182d62e12e2aaff653c37f79cd3feb22ea4b849ea6"
}
diff --git a/rust/cloud-storage/call/src/domain/models.rs b/rust/cloud-storage/call/src/domain/models.rs
index eadd5c8093..5707b3da72 100644
--- a/rust/cloud-storage/call/src/domain/models.rs
+++ b/rust/cloud-storage/call/src/domain/models.rs
@@ -331,6 +331,9 @@ pub struct CallRecordPreviewData {
pub channel_id: Uuid,
/// Resolved display name for the channel.
pub channel_name: Option<String>,
+ /// User-supplied or AI-generated display name for the call. Only set on
+ /// archived `call_records`; active calls always return `None`.
+ pub custom_name: Option<String>,
/// When the call started (created_at for active, started_at for archived).
pub started_at: DateTime<Utc>,
/// When the call ended (None if still active).
diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
index 278c5ea820..736227a85f 100644
--- a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
@@ -1066,7 +1066,8 @@ impl CallRepository for PgCallRepo {
id as "call_id!",
channel_id as "channel_id!",
created_at as "started_at!",
- NULL::timestamptz as "ended_at"
+ NULL::timestamptz as "ended_at",
+ NULL::text as "custom_name"
FROM calls
WHERE id = ANY($1)
UNION ALL
@@ -1074,7 +1075,8 @@ impl CallRepository for PgCallRepo {
id as "call_id!",
channel_id as "channel_id!",
started_at as "started_at!",
- ended_at as "ended_at"
+ ended_at as "ended_at",
+ custom_name as "custom_name"
FROM call_records
WHERE id = ANY($1)
"#,
@@ -1087,6 +1089,7 @@ impl CallRepository for PgCallRepo {
channel_id: Uuid,
started_at: chrono::DateTime<Utc>,
ended_at: Option<chrono::DateTime<Utc>>,
+ custom_name: Option<String>,
}
let mut found: HashMap<Uuid, Found> = HashMap::with_capacity(rows.len());
@@ -1096,6 +1099,7 @@ impl CallRepository for PgCallRepo {
channel_id: row.channel_id,
started_at: row.started_at,
ended_at: row.ended_at,
+ custom_name: row.custom_name,
});
}
@@ -1117,6 +1121,7 @@ impl CallRepository for PgCallRepo {
call_id,
channel_id: f.channel_id,
channel_name: channel_names.get(&f.channel_id).cloned(),
+ custom_name: f.custom_name,
started_at: f.started_at,
ended_at: f.ended_at,
}),