Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions echo/directus/sync/collections/operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "615a54cd-a72e-41ad-9403-9577c80280d6"
"_syncId": "84c38ea6-5d15-429f-8c24-9485d54ba7be"
},
{
"name": "Email Send Operation Failed Dutch",
Expand All @@ -93,7 +93,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "84c38ea6-5d15-429f-8c24-9485d54ba7be"
"_syncId": "615a54cd-a72e-41ad-9403-9577c80280d6"
},
{
"name": "failed",
Expand All @@ -107,7 +107,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "8d8d787a-dbc4-44f9-9ab4-28e3f3d5f31c"
"_syncId": "eb6f8253-647f-4fb1-9010-e93594ba065e"
},
{
"name": "failed",
Expand All @@ -121,7 +121,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "eb6f8253-647f-4fb1-9010-e93594ba065e"
"_syncId": "8d8d787a-dbc4-44f9-9ab4-28e3f3d5f31c"
},
{
"name": "Filter Emails",
Expand All @@ -132,10 +132,10 @@
"options": {
"code": "module.exports = async function(data) {\n\n const submissions = data.get_all_participants;\n \n // Filter submissions to only include those where email_opt_in is true\n const filteredSubmissions = submissions.filter(sub => sub.email_opt_in === true);\n\n // Create an array with email, project_id and an email_opt_out token for each submission\n const result = filteredSubmissions.map(sub => ({\n project_name: data.project_data[0].name || '',\n\t\tdefault_conversation_title: data.project_data[0].default_conversation_title || '',\n\t\tconversation_name: sub.conversation_id.participant_name || '',\n email: sub.email,\n project_id: sub.project_id || '',\n token: sub.email_opt_out_token,\n language: data.check_report_language[0].language || 'empty',\n ADMIN_BASE_URL: \"{{ $env.ADMIN_BASE_URL }}\" || \"http://localhost:5173\",\n PARTICIPANT_BASE_URL: \"{{ $env.PARTICIPANT_BASE_URL }}\" || \"http://localhost:5174\", \n }));\n \n return result;\n};"
},
"resolve": "b8144cee-59f6-40d9-a849-dd0c639e4e31",
"resolve": "e101f00d-2fb8-4f40-9e0e-4d24da5bb1e9",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "ca1ffbc5-cfce-4fb4-8f15-c128ea407d41"
"_syncId": "efb3982e-5703-4c07-8982-a6e1b5218e4a"
},
{
"name": "Filter Emails",
Expand All @@ -146,10 +146,10 @@
"options": {
"code": "module.exports = async function(data) {\n\n const submissions = data.get_all_participants;\n \n // Filter submissions to only include those where email_opt_in is true\n const filteredSubmissions = submissions.filter(sub => sub.email_opt_in === true);\n\n // Create an array with email, project_id and an email_opt_out token for each submission\n const result = filteredSubmissions.map(sub => ({\n project_name: data.project_data[0].name || '',\n\t\tdefault_conversation_title: data.project_data[0].default_conversation_title || '',\n\t\tconversation_name: sub.conversation_id.participant_name || '',\n email: sub.email,\n project_id: sub.project_id || '',\n token: sub.email_opt_out_token,\n language: data.check_report_language[0].language || 'empty',\n ADMIN_BASE_URL: \"{{ $env.ADMIN_BASE_URL }}\" || \"http://localhost:5173\",\n PARTICIPANT_BASE_URL: \"{{ $env.PARTICIPANT_BASE_URL }}\" || \"http://localhost:5174\", \n }));\n \n return result;\n};"
},
"resolve": "e101f00d-2fb8-4f40-9e0e-4d24da5bb1e9",
"resolve": "b8144cee-59f6-40d9-a849-dd0c639e4e31",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "efb3982e-5703-4c07-8982-a6e1b5218e4a"
"_syncId": "ca1ffbc5-cfce-4fb4-8f15-c128ea407d41"
},
{
"name": "log environment vars",
Expand Down Expand Up @@ -213,7 +213,7 @@
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "84852456-3f3a-4906-be94-8b750159883b"
"_syncId": "e8274ad4-5844-42cd-8a6b-d40d08cf83d3"
},
{
"name": "Report Not Published",
Expand All @@ -227,7 +227,7 @@
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "e8274ad4-5844-42cd-8a6b-d40d08cf83d3"
"_syncId": "84852456-3f3a-4906-be94-8b750159883b"
},
{
"name": "Send Email Dutch",
Expand Down Expand Up @@ -256,9 +256,9 @@
]
},
"resolve": null,
"reject": "84c38ea6-5d15-429f-8c24-9485d54ba7be",
"reject": "615a54cd-a72e-41ad-9403-9577c80280d6",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "34fb6ee5-2813-484a-a1cc-f97de097509b"
"_syncId": "ea78ec02-364d-4f18-80f8-ea5ac4c787ed"
},
{
"name": "Send Email Dutch",
Expand Down Expand Up @@ -287,9 +287,9 @@
]
},
"resolve": null,
"reject": "615a54cd-a72e-41ad-9403-9577c80280d6",
"reject": "84c38ea6-5d15-429f-8c24-9485d54ba7be",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "ea78ec02-364d-4f18-80f8-ea5ac4c787ed"
"_syncId": "34fb6ee5-2813-484a-a1cc-f97de097509b"
},
{
"name": "Send Email English",
Expand Down Expand Up @@ -318,9 +318,9 @@
]
},
"resolve": null,
"reject": "2b24450b-6a2e-4452-aba1-9814d17fef42",
"reject": "920bd181-b2a2-4f0d-94dc-3b1a08c3f4ef",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "9390ed2f-7dc6-4a6a-83da-2d87d478261d"
"_syncId": "3dbf2ea1-17f8-4bde-aa89-43278fe9a00f"
},
{
"name": "Send Email English",
Expand Down Expand Up @@ -349,9 +349,9 @@
]
},
"resolve": null,
"reject": "920bd181-b2a2-4f0d-94dc-3b1a08c3f4ef",
"reject": "2b24450b-6a2e-4452-aba1-9814d17fef42",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "3dbf2ea1-17f8-4bde-aa89-43278fe9a00f"
"_syncId": "9390ed2f-7dc6-4a6a-83da-2d87d478261d"
},
{
"name": "Trigger Email Flow",
Expand Down
4 changes: 0 additions & 4 deletions echo/directus/sync/collections/policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
{
"role": "_sync_default_admin_role",
"sort": 1
},
{
"role": null,
"sort": null
}
],
"_syncId": "_sync_default_admin_policy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"readonly": false,
"required": false,
"searchable": true,
"sort": 26,
"sort": 27,
"special": [
"o2m"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"readonly": false,
"required": false,
"searchable": true,
"sort": 23,
"sort": 24,
"special": [
"cast-boolean"
],
Expand Down
46 changes: 46 additions & 0 deletions echo/directus/sync/snapshot/fields/conversation/is_anonymized.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"collection": "conversation",
"field": "is_anonymized",
"type": "boolean",
"meta": {
"collection": "conversation",
"conditions": null,
"display": null,
"display_options": null,
"field": "is_anonymized",
"group": null,
"hidden": false,
"interface": "boolean",
"note": null,
"options": null,
"readonly": false,
"required": false,
"searchable": true,
"sort": 21,
"special": [
"cast-boolean"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
},
"schema": {
"name": "is_anonymized",
"table": "conversation",
"data_type": "boolean",
"default_value": false,
"max_length": null,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": true,
"is_unique": false,
"is_indexed": false,
"is_primary_key": false,
"is_generated": false,
"generation_expression": null,
"has_auto_increment": false,
"foreign_key_table": null,
"foreign_key_column": null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"readonly": false,
"required": false,
"searchable": true,
"sort": 22,
"sort": 23,
"special": [
"cast-boolean"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"readonly": false,
"required": false,
"searchable": true,
"sort": 21,
"sort": 22,
"special": [
"cast-boolean"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"readonly": false,
"required": false,
"searchable": true,
"sort": 24,
"sort": 25,
"special": [
"o2m"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"readonly": false,
"required": false,
"searchable": true,
"sort": 25,
"sort": 26,
"special": [
"o2m"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
useMediaQuery,
useSessionStorage,
} from "@mantine/hooks";
import { ShieldCheckIcon } from "@phosphor-icons/react";
import {
IconArrowsExchange,
IconArrowsUpDown,
Expand Down Expand Up @@ -556,11 +557,13 @@ const ConversationAccordionItem = ({
<Text className="pl-[4px] text-sm font-normal">
{conversation.participant_name || conversation.title}
</Text>

{conversation.title && conversation.participant_name && (
<Tooltip label={conversation.title}>
<IconInfoCircle size={14} className="text-gray-400" />
</Tooltip>
)}

{hasVerifiedArtefacts && (
<Tooltip label={t`Has verified artifacts`}>
<ThemeIcon
Expand All @@ -574,7 +577,22 @@ const ConversationAccordionItem = ({
</ThemeIcon>
</Tooltip>
)}

{conversation.is_anonymized && (
<Tooltip label={t`Anonymized conversation`}>
<ThemeIcon
variant="subtle"
color="primary"
aria-label={t`anonymized conversation`}
size={18}
style={{ cursor: "default" }}
>
<ShieldCheckIcon />
</ThemeIcon>
</Tooltip>
)}
</Group>

<ConversationStatusIndicators
conversation={conversation}
showDuration={showDuration}
Expand Down Expand Up @@ -914,8 +932,11 @@ export const ConversationAccordion = ({

// Handle select all
const handleSelectAllClick = () => {
try { analytics.trackEvent(events.SELECT_ALL_CLICK); }
catch (error) { console.warn("Analytics tracking failed:", error); }
try {
analytics.trackEvent(events.SELECT_ALL_CLICK);
} catch (error) {
console.warn("Analytics tracking failed:", error);
}
Comment on lines +935 to +939
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider extracting a safe analytics helper to DRY up these try/catch blocks.

Four identical try/catch patterns for analytics.trackEvent. A thin wrapper would reduce noise:

♻️ Proposed refactor
// e.g. in analytics.ts or locally
const safeTrackEvent = (...args: Parameters<typeof analytics.trackEvent>) => {
  try {
    analytics.trackEvent(...args);
  } catch (error) {
    console.warn("Analytics tracking failed:", error);
  }
};

Then replace all four sites with safeTrackEvent(events.SELECT_ALL_CLICK), etc. Also applies to the same pattern in ConversationDangerZone.tsx.

Also applies to: 951-955, 967-971, 973-977

🤖 Prompt for AI Agents
In `@echo/frontend/src/components/conversation/ConversationAccordion.tsx` around
lines 935 - 939, Multiple identical try/catch wrappers around
analytics.trackEvent create noise; extract a thin helper (e.g., safeTrackEvent)
that accepts the same parameters as analytics.trackEvent, wraps the call in a
try/catch, and logs failures with the existing warning message, then replace all
occurrences in ConversationAccordion (the calls around events.SELECT_ALL_CLICK
and the other three sites) and ConversationDangerZone with safeTrackEvent to DRY
up the code.

setSelectAllModalOpened(true);
setSelectAllResult(null);
};
Expand All @@ -927,8 +948,11 @@ export const ConversationAccordion = ({
return;
}

try { analytics.trackEvent(events.SELECT_ALL_CONFIRM); }
catch (error) { console.warn("Analytics tracking failed:", error); }
try {
analytics.trackEvent(events.SELECT_ALL_CONFIRM);
} catch (error) {
console.warn("Analytics tracking failed:", error);
}

setSelectAllLoading(true);
try {
Expand All @@ -940,11 +964,17 @@ export const ConversationAccordion = ({
verifiedOnly: showOnlyVerified || undefined,
});
setSelectAllResult(result);
try { analytics.trackEvent(events.SELECT_ALL_SUCCESS); }
catch (error) { console.warn("Analytics tracking failed:", error); }
try {
analytics.trackEvent(events.SELECT_ALL_SUCCESS);
} catch (error) {
console.warn("Analytics tracking failed:", error);
}
} catch (_error) {
try { analytics.trackEvent(events.SELECT_ALL_ERROR); }
catch (error) { console.warn("Analytics tracking failed:", error); }
try {
analytics.trackEvent(events.SELECT_ALL_ERROR);
} catch (error) {
console.warn("Analytics tracking failed:", error);
}
toast.error(t`Failed to add conversations to context`);
setSelectAllModalOpened(false);
} finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { Button, Group, Stack } from "@mantine/core";
import { Button, Group, Stack, Tooltip } from "@mantine/core";
import { IconDownload, IconTrash } from "@tabler/icons-react";
import { useParams } from "react-router";
import { MoveConversationButton } from "@/components/conversation/MoveConversationButton";
Expand All @@ -13,8 +13,10 @@ import { useDeleteConversationByIdMutation } from "./hooks";

export const ConversationDangerZone = ({
conversation,
disableDownloadAudio = false,
}: {
conversation: Conversation;
disableDownloadAudio?: boolean;
}) => {
const deleteConversationByIdMutation = useDeleteConversationByIdMutation();
const navigate = useI18nNavigate();
Expand Down Expand Up @@ -51,19 +53,29 @@ export const ConversationDangerZone = ({
<Stack gap="1rem">
<MoveConversationButton conversation={conversation} />

<Button
variant="outline"
rightSection={<IconDownload size={16} />}
component="a"
target="_blank"
href={getConversationContentLink(conversation.id)}
onClick={handleDownloadAudio}
{...testId("conversation-download-audio-button")}
<Tooltip
label={t`Audio download not available for anonymized conversations`}
disabled={!disableDownloadAudio}
>
<Group>
<Trans>Download Audio</Trans>
</Group>
</Button>
<Button
variant="outline"
rightSection={<IconDownload size={16} />}
component="a"
target="_blank"
href={
disableDownloadAudio
? undefined
: getConversationContentLink(conversation.id)
}
onClick={disableDownloadAudio ? undefined : handleDownloadAudio}
disabled={disableDownloadAudio}
{...testId("conversation-download-audio-button")}
>
<Group>
<Trans>Download Audio</Trans>
</Group>
</Button>
</Tooltip>

<Button
onClick={handleDelete}
Expand Down
Loading
Loading