feat(uat-batch-13): activity feed resolves user UUIDs to display names
Audit-log rows with user-FK diffs (assignedTo, ownerId, reassignedTo, createdBy, addedBy, changedBy, transferredBy) previously rendered the raw user UUID in the activity feed (e.g. "→ mEcsLxo5kyFMyhbOSehxJjY…"). Same gap on the row's actor — the rep had no idea who did what. - getRecentActivity collects all userIds referenced by either the row's actor (auditLogs.userId) or by user-FK diff values, then bulk-fetches user_profiles in a single query. Output rows now carry an `actorName` field and have their `oldValue`/`newValue` swapped for display names on user-FK fields. - Unknown / deleted users fall back to "Unknown user (#short-uuid)" so the audit trail stays useful for forensics. - ActivityItem client type extended with `actorName`. Existing consumers still read the raw `userId` for forensics + deep-link. tsc clean. 1419/1419 vitest pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,14 @@ interface ActivityItem {
|
||||
* underlying entity still exists. Falls back to the id prefix in the UI. */
|
||||
label: string | null;
|
||||
userId: string | null;
|
||||
/** Server-resolved actor display name (from user_profiles). When null,
|
||||
* the actor row no longer exists — render falls back to a "Unknown
|
||||
* user" sentinel rather than the raw UUID prefix. */
|
||||
actorName: string | null;
|
||||
fieldChanged: string | null;
|
||||
/** For user-FK diff rows (assignedTo, ownerId, etc.) the service
|
||||
* already replaces these with display names. Non-user-FK rows pass
|
||||
* through verbatim. */
|
||||
oldValue: unknown;
|
||||
newValue: unknown;
|
||||
metadata: Record<string, unknown> | null;
|
||||
|
||||
Reference in New Issue
Block a user