mirror of
https://github.com/outline/outline.git
synced 2026-12-01 09:22:14 +03:00
* chore: Remove unused lint disable directives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Replace TODO type suppressions with typed code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Remove obsolete workaround comments in tests and MediaDimension Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Remove Tippy compatibility props from Tooltip Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Decouple DropdownMenu props from Tooltip and clarify sharing styles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Remove stale retention TODOs from cleanup tasks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Register relations synchronously and clarify workaround comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Replace Notion import TODOs with descriptive comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH --------- Co-authored-by: Claude <noreply@anthropic.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import parseTitle from "@shared/utils/parseTitle";
|
|
import { traceFunction } from "@server/logging/tracing";
|
|
import type { Revision } from "@server/models";
|
|
import { DocumentHelper } from "@server/models/helpers/DocumentHelper";
|
|
import presentUser from "./user";
|
|
|
|
type PresentRevisionOptions = {
|
|
/**
|
|
* Whether to include the document content. Defaults to true.
|
|
*/
|
|
includeContent?: boolean;
|
|
};
|
|
|
|
async function presentRevision(
|
|
revision: Revision,
|
|
options: PresentRevisionOptions = {}
|
|
) {
|
|
const { includeContent = true } = options;
|
|
|
|
// Older revisions may store the emoji icon as a prefix of the title.
|
|
const { emoji, strippedTitle } = parseTitle(revision.title);
|
|
|
|
const [data, text, collaborators] = await Promise.all([
|
|
includeContent ? DocumentHelper.toJSON(revision) : undefined,
|
|
includeContent ? DocumentHelper.toMarkdown(revision) : undefined,
|
|
revision.collaborators,
|
|
]);
|
|
|
|
return {
|
|
id: revision.id,
|
|
documentId: revision.documentId,
|
|
title: strippedTitle,
|
|
name: revision.name,
|
|
data,
|
|
text,
|
|
icon: revision.icon ?? emoji,
|
|
color: revision.color,
|
|
collaborators: collaborators.map((user) => presentUser(user)),
|
|
sourceMetadata: revision.sourceMetadata
|
|
? {
|
|
authType: revision.sourceMetadata.authType,
|
|
}
|
|
: undefined,
|
|
createdAt: revision.createdAt,
|
|
createdBy: presentUser(revision.user),
|
|
createdById: revision.userId,
|
|
deletedAt: revision.deletedAt,
|
|
};
|
|
}
|
|
|
|
export default traceFunction({
|
|
spanName: "presenters",
|
|
})(presentRevision);
|