Files
Tom MoorandClaude Opus 5 8c66b56c3b feat: Show auth type in document history (#13294)
Surface when a history event was performed via the API or MCP, e.g.
"Tom published via MCP". Moves AuthenticationType to shared types and
exposes authType on the event presenter.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 21:45:21 -04:00

28 lines
669 B
TypeScript

import type { Event } from "@server/models";
import presentUser from "./user";
export default function presentEvent(event: Event, isAdmin = false) {
const data = {
id: event.id,
name: event.name,
modelId: event.modelId,
userId: event.userId,
actorId: event.actorId,
authType: event.authType,
actorIpAddress: event.ip || undefined,
collectionId: event.collectionId,
documentId: event.documentId,
createdAt: event.createdAt,
data: event.data,
changes: event.changes || undefined,
actor: presentUser(event.actor),
};
if (!isAdmin) {
delete data.changes;
delete data.actorIpAddress;
}
return data;
}