From 4690c4d929ded799020e2a70d6d02a6cc7f05b3a Mon Sep 17 00:00:00 2001 From: Ivan Mercedes Date: Wed, 8 Jul 2026 07:58:33 -0400 Subject: [PATCH] refactor: address PR feedback for security and cleanups - refactor: migrate dangerouslySetInnerHTML(t.raw) to t.rich() to prevent HTML injection vectors - fix: restore per-status wording for flow activation toasts ("Flow activated.", "Archived.", "Saved as draft.") - chore: remove unused `tComposer` in message-thread.tsx - chore: remove unused `ROLE_DESCRIPTIONS` in invite-member-dialog.tsx --- messages/en.json | 4 +++- src/components/flows/flow-builder.tsx | 4 +++- src/components/flows/flow-editor-state.tsx | 8 +++++++- src/components/inbox/message-thread.tsx | 1 - src/components/settings/invite-member-dialog.tsx | 6 ------ src/components/settings/members-tab.tsx | 4 +++- src/components/settings/template-manager.tsx | 4 ++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/messages/en.json b/messages/en.json index d4a4ede..8ae4363 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1144,7 +1144,9 @@ "editorState": { "saved": "Saved.", "fixIssues": "Fix the issues below before activating.", - "statusChanged": "Flow is now {status}." + "statusActivated": "Flow activated.", + "statusArchived": "Archived.", + "statusDraft": "Saved as draft." }, "summary": { "options": "{count} {count, plural, =1 {option} other {options}}", diff --git a/src/components/flows/flow-builder.tsx b/src/components/flows/flow-builder.tsx index 66f0528..e1a5b81 100644 --- a/src/components/flows/flow-builder.tsx +++ b/src/components/flows/flow-builder.tsx @@ -174,7 +174,9 @@ export function FlowBuilder() { {state.nodes.length === 0 ? ( -
+
+ {t.rich('nodesEmpty', { strong: (chunks) => {chunks} })} +
) : ( state.nodes.map((node) => ( ({ ...s, status: next })); - toast.success(t("statusChanged", { status: next })); + toast.success( + next === "active" + ? t("statusActivated") + : next === "archived" + ? t("statusArchived") + : t("statusDraft") + ); } catch (err) { const msg = err instanceof Error ? err.message : "Status update failed"; toast.error(msg); diff --git a/src/components/inbox/message-thread.tsx b/src/components/inbox/message-thread.tsx index 310710f..bc9ed35 100644 --- a/src/components/inbox/message-thread.tsx +++ b/src/components/inbox/message-thread.tsx @@ -168,7 +168,6 @@ export function MessageThread({ }: MessageThreadProps) { const t = useTranslations("Inbox.messageThread"); const tTimer = useTranslations("Inbox.sessionTimer"); - const tComposer = useTranslations("Inbox.composer"); const tQuote = useTranslations("Inbox.replyQuote"); const { user } = useAuth(); diff --git a/src/components/settings/invite-member-dialog.tsx b/src/components/settings/invite-member-dialog.tsx index b48c9a1..b211491 100644 --- a/src/components/settings/invite-member-dialog.tsx +++ b/src/components/settings/invite-member-dialog.tsx @@ -55,12 +55,6 @@ const EXPIRY_OPTIONS = [ { value: '30', labelKey: 'days30' }, ]; -const ROLE_DESCRIPTIONS = [ - 'adminHint', - 'agentHint', - 'viewerHint', -]; - // Server caps label at 80 chars (see src/app/api/account/invitations/route.ts). // Mirror it on the client so we short-circuit before the round-trip // rather than letting the user submit and bounce off a 400. diff --git a/src/components/settings/members-tab.tsx b/src/components/settings/members-tab.tsx index 9b15f2d..6aa296f 100644 --- a/src/components/settings/members-tab.tsx +++ b/src/components/settings/members-tab.tsx @@ -503,7 +503,9 @@ export function MembersTab() {

{t('noPendingTitle')}

-

+

+ {t.rich('noPendingDesc', { bold: (chunks) => {chunks} })} +

) : ( diff --git a/src/components/settings/template-manager.tsx b/src/components/settings/template-manager.tsx index d80c825..827cb12 100644 --- a/src/components/settings/template-manager.tsx +++ b/src/components/settings/template-manager.tsx @@ -653,7 +653,7 @@ export function TemplateManager() { {form.category === 'Authentication' && (
-

+

{t.rich('authWarning', { bold: (chunks) => {chunks} })}

)} @@ -724,7 +724,7 @@ export function TemplateManager() { {editingId ? ( t('langFixed') ) : ( - + {t.rich('langHint', { code: (chunks) => {chunks} })} )}