Files
outline/server/presenters/template.ts
T
Tom MoorandClaude Opus 5 39fec9e7c7 fix: Crash inserting a template with no content from the block menu (#13345)
Template content is nullable, but the presenter passed it through raw so
a template without content reached the client with no data at all.

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

26 lines
789 B
TypeScript

import { ProsemirrorDataHelper } from "@shared/utils/ProsemirrorDataHelper";
import type { Template } from "@server/models";
import presentUser from "./user";
function presentTemplate(template: Template) {
return {
id: template.id,
url: template.path,
urlId: template.urlId,
title: template.title,
data: template.content ?? ProsemirrorDataHelper.getEmpty(),
icon: template.icon,
color: template.color,
createdAt: template.createdAt,
createdBy: presentUser(template.createdBy),
updatedAt: template.updatedAt,
updatedBy: presentUser(template.updatedBy),
deletedAt: template.deletedAt,
publishedAt: template.publishedAt,
fullWidth: template.fullWidth,
collectionId: template.collectionId,
};
}
export default presentTemplate;