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): show a paperclip next to the date of threads with files (#8222)

teoa448e4e8f290
diff --git a/apps/web/src/features/entity/extractors/entity-timestamp.tsx b/apps/web/src/features/entity/extractors/entity-timestamp.tsx
index a7c5824ba8..49e6483b49 100644
--- a/apps/web/src/features/entity/extractors/entity-timestamp.tsx
+++ b/apps/web/src/features/entity/extractors/entity-timestamp.tsx
@@ -1,4 +1,5 @@
import type { DateValue } from '@core/util/date';
+import PaperclipIcon from '@phosphor/paperclip.svg';
import { Show } from 'solid-js';
import { ScheduledBadge } from '../components/Badges';
import { type EntityData, isEmailEntity } from '../types/entity';
@@ -19,9 +20,23 @@ export function EntityTimestamp(props: {
!props.overrideTimeStamp && isEmailEntity(props.entity)
? props.entity.scheduledSendTime
: undefined;
- return (
+ const hasFileAttachment = () =>
+ isEmailEntity(props.entity) && props.entity.hasFileAttachment === true;
+ const stamp = () => (
<Show when={scheduledSendTime()} fallback={formatTimestamp(timestamp())}>
{(sendTime) => <ScheduledBadge sendTime={sendTime()} />}
</Show>
);
+ return (
+ <Show when={hasFileAttachment()} fallback={stamp()}>
+ <span class="flex items-center gap-1 whitespace-nowrap">
+ <PaperclipIcon
+ class="size-3.5 shrink-0"
+ role="img"
+ aria-label="Has attachments"
+ />
+ {stamp()}
+ </span>
+ </Show>
+ );
}
diff --git a/apps/web/src/features/entity/tests/entity-timestamp.test.tsx b/apps/web/src/features/entity/tests/entity-timestamp.test.tsx
new file mode 100644
index 0000000000..65946e96e8
--- /dev/null
+++ b/apps/web/src/features/entity/tests/entity-timestamp.test.tsx
@@ -0,0 +1,69 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { EntityTimestamp } from '../extractors/entity-timestamp';
+import type { EmailEntity, EntityData } from '../types/entity';
+
+vi.mock('@core/component/UserIcon', () => ({ UserIcon: () => null }));
+
+describe('EntityTimestamp attachment indicator', () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date(2026, 9, 17, 12, 0));
+ });
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+
+ it('shows a paperclip next to the date of an email with an attached file', () => {
+ const email: EmailEntity = {
+ type: 'email',
+ id: 'thread-with-pdf',
+ name: 'Signed contract',
+ ownerId: 'macro|[email protected]',
+ sortTs: new Date(2026, 9, 15, 9, 30).toISOString(),
+ isRead: true,
+ isDraft: false,
+ isImportant: false,
+ done: false,
+ hasFileAttachment: true,
+ };
+ render(() => <EntityTimestamp entity={email} />);
+
+ expect(screen.getByRole('img', { name: 'Has attachments' })).toBeTruthy();
+ expect(screen.getByText('Oct 15')).toBeTruthy();
+ });
+
+ it('drops the paperclip when a recycled row moves to an email without files', () => {
+ const [entity, setEntity] = createSignal<EntityData>({
+ type: 'email',
+ id: 'thread-with-pdf',
+ name: 'Signed contract',
+ ownerId: 'macro|[email protected]',
+ sortTs: new Date(2026, 9, 15, 9, 30).toISOString(),
+ isRead: true,
+ isDraft: false,
+ isImportant: false,
+ done: false,
+ hasFileAttachment: true,
+ });
+ render(() => <EntityTimestamp entity={entity()} />);
+
+ setEntity({
+ type: 'email',
+ id: 'thread-with-logo',
+ name: 'Quick question',
+ ownerId: 'macro|[email protected]',
+ sortTs: new Date(2026, 9, 14, 9, 30).toISOString(),
+ isRead: true,
+ isDraft: false,
+ isImportant: false,
+ done: false,
+ hasFileAttachment: false,
+ });
+
+ expect(screen.queryByRole('img', { name: 'Has attachments' })).toBeNull();
+ expect(screen.getByText('Oct 14')).toBeTruthy();
+ });
+});
diff --git a/apps/web/src/features/entity/types/entity.ts b/apps/web/src/features/entity/types/entity.ts
index 14049ec415..95e9f06eb8 100644
--- a/apps/web/src/features/entity/types/entity.ts
+++ b/apps/web/src/features/entity/types/entity.ts
@@ -302,6 +302,8 @@ export type EmailEntity = EntityBase & {
linkId?: string;
labels?: SoupLabel[] | ApiLabel[];
hasIcsAttachment?: boolean;
+ /** A sent file, not an inline image or calendar invite, is on the thread. */
+ hasFileAttachment?: boolean;
attachments?: EmailAttachment[];
properties?: SoupProperty[];
/** ISO 8601 time of the thread draft's confirmed scheduled send. */
diff --git a/apps/web/src/lib/queries/soup/transform-utils.test.ts b/apps/web/src/lib/queries/soup/transform-utils.test.ts
index 5923739c4f..5cc1f994fd 100644
--- a/apps/web/src/lib/queries/soup/transform-utils.test.ts
+++ b/apps/web/src/lib/queries/soup/transform-utils.test.ts
@@ -44,6 +44,94 @@ describe('email soup entities', () => {
});
}
);
+
+ it.each([
+ ['no attachments', [], false],
+ [
+ 'an attached PDF',
+ [{ filename: 'contract.pdf', mimeType: 'application/pdf' }],
+ true,
+ ],
+ [
+ 'a PDF that carries a Content-ID',
+ [
+ {
+ filename: 'contract.pdf',
+ mimeType: 'application/pdf',
+ contentId: '<contract@outlook>',
+ },
+ ],
+ true,
+ ],
+ [
+ 'an attached photo',
+ [{ filename: 'photo.jpg', mimeType: 'image/jpeg' }],
+ true,
+ ],
+ [
+ 'only an inline signature logo',
+ [
+ {
+ filename: 'logo.png',
+ mimeType: 'image/png',
+ contentId: '<logo@signature>',
+ },
+ ],
+ false,
+ ],
+ [
+ 'only a calendar invite',
+ [{ filename: 'invite.ics', mimeType: 'text/calendar' }],
+ false,
+ ],
+ [
+ 'an inline logo alongside a spreadsheet',
+ [
+ {
+ filename: 'logo.png',
+ mimeType: 'image/png',
+ contentId: '<logo@signature>',
+ },
+ {
+ filename: 'budget.xlsx',
+ mimeType:
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ },
+ ],
+ true,
+ ],
+ ])('flags a file attachment for %s', (_case, files, hasFileAttachment) => {
+ const item = {
+ tag: 'emailThread',
+ frecency_score: 0,
+ is_favorited: false,
+ data: {
+ id: 'email',
+ ownerId: 'owner',
+ properties: [],
+ attachments: files.map((file, index) => ({
+ ...file,
+ id: `attachment-${index}`,
+ messageId: 'message',
+ createdAt: '2026-09-01T00:00:00Z',
+ })),
+ labels: [],
+ participants: [],
+ createdAt: '2026-09-01T00:00:00Z',
+ updatedAt: '2026-09-01T00:00:00Z',
+ sortTs: '2026-09-01T00:00:00Z',
+ inboxVisible: true,
+ isDraft: false,
+ isRead: false,
+ isImportant: false,
+ isSignal: false,
+ },
+ } satisfies SoupApiItem;
+ expect(mapApiSoupItemToEntity(item)).toMatchObject({
+ type: 'email',
+ hasFileAttachment,
+ });
+ });
});
describe('initiative soup entities', () => {
diff --git a/apps/web/src/lib/queries/soup/transform-utils.ts b/apps/web/src/lib/queries/soup/transform-utils.ts
index e4e92cfd41..00df0badca 100644
--- a/apps/web/src/lib/queries/soup/transform-utils.ts
+++ b/apps/web/src/lib/queries/soup/transform-utils.ts
@@ -48,6 +48,7 @@ import type {
import type {
GithubPullRequest,
SoupApiItem,
+ SoupAttachment,
SoupCalendarEventTime,
SoupPage,
SoupProperty,
@@ -688,6 +689,13 @@ function normalizeSentinelTs(
return Date.parse(ts) > 0 ? ts : undefined;
}
+function isCalendarAttachment(attachment: SoupAttachment): boolean {
+ return (
+ attachment.mimeType === 'text/calendar' ||
+ attachment.filename?.toLowerCase().endsWith('.ics') === true
+ );
+}
+
function withRawNotifications<T extends SoupEntity>(
entity: T,
item: DisplayableSoupItem
@@ -774,10 +782,14 @@ export const mapApiSoupItemToEntity = (
name: p.name ?? '',
}));
- const hasIcsAttachment = item.data.attachments?.some(
+ const hasIcsAttachment =
+ item.data.attachments?.some(isCalendarAttachment);
+
+ // Inline images (signature logos, pasted screenshots) carry a Content-ID.
+ const hasFileAttachment = item.data.attachments?.some(
(a) =>
- a.mimeType === 'text/calendar' ||
- a.filename?.toLowerCase().endsWith('.ics')
+ !isCalendarAttachment(a) &&
+ !(a.contentId && a.mimeType?.startsWith('image/'))
);
const attachments = item.data.attachments?.map((a) => ({
@@ -809,6 +821,7 @@ export const mapApiSoupItemToEntity = (
linkId,
participants,
hasIcsAttachment,
+ hasFileAttachment,
attachments,
} satisfies EmailEntity;
})
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index 54ec6faf49..6d6d158e58 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -82,6 +82,11 @@ Rows offer **Unarchive email**;
unarchiving removes the row at once. The tab persists across reloads. An empty
list shows `No archived email`.
+A thread carrying a sent file shows a muted paperclip immediately before its
+date, in every list layout. Inline images (an image with a Content-ID, such as
+a signature logo) and calendar invites do not count; invites keep their own row
+icon. Search-service results carry no attachments, so they never show it.
+
On desktop, a favorited email keeps a filled, muted star just before its
timestamp. Other rows reserve only that small star slot. Hovering reveals
**Star email** (Macro favorites), **Archive email** (Mark Done, with Undo), and