Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(action-center): show a picked assignee's e-mail at once in the action drawer (#1232)

Cihan0f8dfe1aba85
diff --git a/web/src/components/action-center/action-drawer.tsx b/web/src/components/action-center/action-drawer.tsx
index 46eb18fc3..feff0bf73 100644
--- a/web/src/components/action-center/action-drawer.tsx
+++ b/web/src/components/action-center/action-drawer.tsx
@@ -53,6 +53,7 @@ import {
actionGoal,
actionTexts,
memberLabel,
+ pickedAssignee,
taskText,
} from '@/lib/action-center/display';
import { signalTexts } from '@/lib/signals/display';
@@ -406,18 +407,8 @@ export function ActionDrawer({
value={action.assignee?.id ?? 'unassigned'}
onValueChange={(value) => {
const assigneeId = value === 'unassigned' ? null : value;
- const member = members.find((m) => m.userId === assigneeId);
- void changeField(
- {
- assignee: assigneeId
- ? {
- id: assigneeId,
- fullName: member?.fullName ?? null,
- avatarUrl: member?.avatarUrl ?? null,
- }
- : null,
- },
- () => assignAction(brandId, action.id, assigneeId),
+ void changeField({ assignee: pickedAssignee(assigneeId, members) }, () =>
+ assignAction(brandId, action.id, assigneeId),
);
}}
items={[
diff --git a/web/src/lib/action-center/display.test.ts b/web/src/lib/action-center/display.test.ts
index c834f1187..4ad65c7bf 100644
--- a/web/src/lib/action-center/display.test.ts
+++ b/web/src/lib/action-center/display.test.ts
@@ -11,6 +11,7 @@ import {
eventTaskText,
humanizeKind,
labelInitials,
+ pickedAssignee,
taskText,
} from './display';
import { ACTION_KINDS } from './registry';
@@ -433,6 +434,35 @@ describe('History events', () => {
});
});
+describe('pickedAssignee', () => {
+ const members = [
+ { userId: 'u1', email: '[email protected]', fullName: 'Ada Lovelace', avatarUrl: 'a.png' },
+ { userId: 'u2', email: '[email protected]', fullName: null, avatarUrl: null },
+ ];
+
+ it("shows the picked member at once, a nameless one by e-mail (#1147's patch)", () => {
+ expect(pickedAssignee('u1', members)).toEqual({
+ id: 'u1',
+ fullName: 'Ada Lovelace',
+ avatarUrl: 'a.png',
+ email: '[email protected]',
+ });
+ const nameless = pickedAssignee('u2', members);
+ expect(nameless?.email).toBe('[email protected]');
+ expect(assigneeLabel(nameless!)).toBe('[email protected]');
+ });
+
+ it('is nobody for Unassigned, and an id alone for a member the list no longer has', () => {
+ expect(pickedAssignee(null, members)).toBeNull();
+ expect(pickedAssignee('gone', members)).toEqual({
+ id: 'gone',
+ fullName: null,
+ avatarUrl: null,
+ email: null,
+ });
+ });
+});
+
describe('assigneeLabel and labelInitials', () => {
it('names an assignee by name, else by e-mail, else not at all', () => {
expect(assigneeLabel({ fullName: ' Ada Lovelace ', email: '[email protected]' })).toBe(
diff --git a/web/src/lib/action-center/display.ts b/web/src/lib/action-center/display.ts
index b747e4059..27a1e7c52 100644
--- a/web/src/lib/action-center/display.ts
+++ b/web/src/lib/action-center/display.ts
@@ -255,6 +255,25 @@ export function memberLabel(member: { fullName: string | null; email: string }):
return member.fullName?.trim() || member.email;
}
+/**
+ * The assignee an action shows the moment one is picked, before the list is
+ * read again: the member's name, avatar and e-mail, so a member without a
+ * name is named by e-mail at once (assigneeLabel), not left blank.
+ */
+export function pickedAssignee(
+ assigneeId: string | null,
+ members: { userId: string; email: string; fullName: string | null; avatarUrl: string | null }[],
+): ActionItem['assignee'] {
+ if (!assigneeId) return null;
+ const member = members.find((m) => m.userId === assigneeId);
+ return {
+ id: assigneeId,
+ fullName: member?.fullName ?? null,
+ avatarUrl: member?.avatarUrl ?? null,
+ email: member?.email ?? null,
+ };
+}
+
/** An action's assignee named as the picker names them: null when nothing is known. */
export function assigneeLabel(assignee: {
fullName: string | null;