mirror of
https://github.com/outline/outline.git
synced 2026-11-23 06:11:04 +03:00
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>
28 lines
669 B
TypeScript
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;
|
|
}
|