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.

feat(email): edit shared inbox signatures from settings (#9559)

gbirmancc7cbfc4a98c
diff --git a/apps/web/src/features/settings/SignatureSection.tsx b/apps/web/src/features/settings/SignatureSection.tsx
index 67f7609719..8c146b655a 100644
--- a/apps/web/src/features/settings/SignatureSection.tsx
+++ b/apps/web/src/features/settings/SignatureSection.tsx
@@ -46,7 +46,11 @@ function saveSignatureErrorMessage(error: Error): string {
* patches `email_settings` on save. The "replies & forwards" toggle patches
* immediately (the backend patch is partial, so it leaves the signature alone).
*/
-export function SignatureSection(props: { link: EmailLink }) {
+export function SignatureSection(props: {
+ link: EmailLink;
+ /** The inbox belongs to another account; its one signature is everyone's. */
+ shared?: boolean;
+}) {
const signature = useEmailSignature(() => props.link.id);
// Draft lives in the module-level store (keyed by link id) so it survives the
// settings tab unmounting; `null` means "no unsaved edit".
@@ -174,6 +178,7 @@ export function SignatureSection(props: { link: EmailLink }) {
return (
<SignatureForm
email={props.link.email_address}
+ shared={props.shared}
value={isMobile() ? persisted() : (draft() ?? persisted())}
onInput={(html) => {
setDraft(html);
diff --git a/apps/web/src/features/settings/components/signature-form.test.tsx b/apps/web/src/features/settings/components/signature-form.test.tsx
index 78965e28c7..17d6800dea 100644
--- a/apps/web/src/features/settings/components/signature-form.test.tsx
+++ b/apps/web/src/features/settings/components/signature-form.test.tsx
@@ -69,3 +69,12 @@ it('hides Gmail import on mobile or without a handler', () => {
screen.queryByRole('button', { name: 'Import from Gmail' })
).toBeNull();
});
+
+it('says a shared inbox signature applies to everyone who sends from it', () => {
+ render(() => <SignatureForm {...baseProps} mobile={false} shared />);
+ expect(
+ screen.getByText(
+ 'Shared inbox. Automatically added to new emails anyone sends from this account.'
+ )
+ ).toBeTruthy();
+});
diff --git a/apps/web/src/features/settings/components/signature-form.tsx b/apps/web/src/features/settings/components/signature-form.tsx
index d7776c55ec..a2d83a7277 100644
--- a/apps/web/src/features/settings/components/signature-form.tsx
+++ b/apps/web/src/features/settings/components/signature-form.tsx
@@ -7,6 +7,7 @@ import { SignatureWorkspace } from './signature-workspace';
export function SignatureForm(props: {
email: string;
+ shared?: boolean;
value: string;
onInput: (html: string) => void;
onReady: (api: { setContent: (html: string) => void }) => void;
@@ -31,7 +32,9 @@ export function SignatureForm(props: {
<div class="min-w-0">
<h3 class="text-base font-medium break-all">{props.email}</h3>
<p class="mt-1 text-sm text-ink-muted">
- Automatically added to new emails from this account.
+ {props.shared
+ ? 'Shared inbox. Automatically added to new emails anyone sends from this account.'
+ : 'Automatically added to new emails from this account.'}
</p>
</div>
<Show when={!props.mobile && props.onImport}>
diff --git a/apps/web/src/features/settings/email-settings.test.tsx b/apps/web/src/features/settings/email-settings.test.tsx
index 8f455826cd..cc43c8c92d 100644
--- a/apps/web/src/features/settings/email-settings.test.tsx
+++ b/apps/web/src/features/settings/email-settings.test.tsx
@@ -32,7 +32,16 @@ vi.mock('@queries/email/settings', () => ({
useUpdateEmailSettingsMutation: () => ({ isPending: false, mutate: vi.fn() }),
}));
vi.mock('./Email', () => ({ EmailCard: () => null }));
-vi.mock('./SignatureSection', () => ({ SignatureSection: () => null }));
+vi.mock('./SignatureSection', () => ({
+ SignatureSection: (props: {
+ link: { email_address: string };
+ shared?: boolean;
+ }) => {
+ const row = document.createElement('p');
+ row.textContent = `Signature for ${props.link.email_address}${props.shared ? ', shared' : ''}`;
+ return row;
+ },
+}));
const link = {
id: 'link-1',
@@ -78,3 +87,31 @@ describe('EmailSettings read receipts', () => {
expect(screen.queryByRole('switch')).toBeNull();
});
});
+
+describe('EmailSignatures', () => {
+ it('lists shared inboxes beside owned ones and marks them shared', () => {
+ mocks.query = {
+ isPending: false,
+ isError: false,
+ isSuccess: true,
+ data: {
+ links: [
+ link,
+ {
+ id: 'link-2',
+ macro_id: 'macro|[email protected]',
+ email_address: '[email protected]',
+ settings: { read_receipts_enabled: true },
+ },
+ ],
+ },
+ refetch: vi.fn(),
+ };
+ render(() => <EmailSettings />);
+
+ expect(screen.getByText('Signature for [email protected]')).toBeTruthy();
+ expect(
+ screen.getByText('Signature for [email protected], shared')
+ ).toBeTruthy();
+ });
+});
diff --git a/apps/web/src/features/settings/email-settings.tsx b/apps/web/src/features/settings/email-settings.tsx
index c5602c39f2..7189e2cc0e 100644
--- a/apps/web/src/features/settings/email-settings.tsx
+++ b/apps/web/src/features/settings/email-settings.tsx
@@ -121,10 +121,7 @@ export function EmailSettings() {
function EmailSignatures() {
const userId = useUserId();
const { query } = useEmailLinks();
- const links = () =>
- query.isSuccess
- ? query.data.links.filter((link) => link.macro_id === userId())
- : [];
+ const links = () => (query.isSuccess ? query.data.links : []);
return (
<Show
when={!query.isError}
@@ -165,7 +162,10 @@ function EmailSignatures() {
</p>
}
>
- <SignatureSection link={link} />
+ <SignatureSection
+ link={link}
+ shared={link.macro_id !== userId()}
+ />
</Suspense>
)}
</For>
diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.md
index bed8023641..96ab2580d6 100644
--- a/docs/agent-guide/settings.md
+++ b/docs/agent-guide/settings.md
@@ -60,8 +60,10 @@ live-backend release gates and documents staging retention and recovery.
### Email signatures
-Open **Settings → Email → Signatures**. Each owned inbox opens in **Preview**,
-using the same isolated HTML renderer as the email composer. **HTML** lets you
+Open **Settings → Email → Signatures**. Each inbox you can send from, shared
+inboxes included, opens in **Preview**, using the same isolated HTML renderer
+as the email composer. A shared inbox has one signature, so its row says it is
+shared and a save changes the signature for everyone who sends from it. **HTML** lets you
paste or edit a custom signature without flattening its tables or spacing.
**Rich text** offers text formatting, links, and image uploads; opening a custom
HTML layout there asks before converting it. Switching views alone never changes