chore: Rename titleWithDefault to displayTitle (#14063)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-10-13 11:59:44 +00:00
1 parent c46fbc6375
commit dccd9fcfe9
48 files changed
+93 -101

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@ export const deleteTemplate = dialogActionFactory({
<Trans
defaults="Are you sure about that? Deleting the <em>{{ templateName }}</em> template is permanent."
values={{
templateName: templates[0].titleWithDefault,
templateName: templates[0].displayTitle,
}}
components={{
em: <strong />,
+2 -2
View File
@@ -25,7 +25,7 @@ export const getCurrentContext = createAction({
document: document
? {
id: document.id,
title: document.titleWithDefault,
title: document.displayTitle,
path: document.url,
}
: undefined,
@@ -69,7 +69,7 @@ export const searchWorkspace = createAction({
return JSON.stringify(
results.map((result) => ({
id: result.document.id,
title: result.document.titleWithDefault,
title: result.document.displayTitle,
path: result.document.url,
context: result.context,
}))
+2 -2
View File
@@ -30,7 +30,7 @@ DocumentsSection.priority = 0.8;
export const ActiveDocumentSection = ({ t, stores }: ActionContext) => {
const activeDocument = stores.documents.active;
return `${t("Document")} · ${activeDocument?.titleWithDefault}`;
return `${t("Document")} · ${activeDocument?.displayTitle}`;
};
ActiveDocumentSection.priority = 0.9;
@@ -39,7 +39,7 @@ export const TemplateSection = ({ t }: ActionContext) => t("Template");
export const ActiveTemplateSection = ({ t, stores }: ActionContext) => {
const activeTemplate = stores.templates.active;
return `${t("Template")} · ${activeTemplate?.titleWithDefault}`;
return `${t("Template")} · ${activeTemplate?.displayTitle}`;
};
ActiveTemplateSection.priority = 0.9;
@@ -43,7 +43,7 @@ const useRecentDocumentActions = (count = recentDocumentCount) => {
count
).map((item) =>
createInternalLinkAction({
name: item.titleWithDefault,
name: item.displayTitle,
analyticsName: "Recently viewed document",
section: RecentSection,
visible: ({ isMCP }) => !isMCP,
+1 -1
View File
@@ -49,7 +49,7 @@ export function toSearchRecord(
): SearchIndexDocument {
return {
id: doc.id,
title: doc.titleWithDefault,
title: doc.displayTitle,
url: doc.url,
text: doc.data ? getPlainText(doc) : stripHighlightTags(context),
icon: doc.icon,
@@ -28,7 +28,7 @@ const useTemplatesAction = () => {
() =>
templates.alphabetical.map((template) =>
createInternalLinkAction({
name: template.titleWithDefault,
name: template.displayTitle,
analyticsName: "New document",
section: template.isWorkspaceTemplate
? TeamSection
+1 -1
View File
@@ -60,7 +60,7 @@ export const DialogTitle = observer(function DialogTitle_({
<Subject type="secondary" size="small">
{icon}
<Text type="secondary" ellipsis>
{isDocument ? model.titleWithDefault : model.displayName}
{isDocument ? model.displayTitle : model.displayName}
</Text>
</Subject>
</Wrapper>
+3 -3
View File
@@ -127,7 +127,7 @@ function DocumentCard(props: Props) {
to={{
pathname: document.path,
state: {
title: document.titleWithDefault,
title: document.displayTitle,
},
}}
>
@@ -169,8 +169,8 @@ function DocumentCard(props: Props) {
<div>
<Heading dir={document.dir}>
{hasEmojiInTitle
? document.titleWithDefault.replace(document.icon!, "")
: document.titleWithDefault}
? document.displayTitle.replace(document.icon!, "")
: document.displayTitle}
</Heading>
<DocumentMeta size="xsmall">
{isRecentlyUpdated ? (
+1 -1
View File
@@ -34,7 +34,7 @@ export const DocumentChip = observer(function DocumentChip_({
const { icon, color } = document;
const canPin = usePolicy(pin);
const canDocument = usePolicy(document);
const title = document.titleWithDefault;
const title = document.displayTitle;
const isEmoji = determineIconType(icon) === IconType.Emoji;
// Pins in a collection are governed by the document policy, pins on home by
+2 -2
View File
@@ -170,7 +170,7 @@ function DocumentListItem(props: Props) {
pathname: documentPath(document),
search: highlight ? `?q=${encodeURIComponent(highlight)}` : undefined,
state: {
title: document.titleWithDefault,
title: document.displayTitle,
sidebarContext,
},
}}
@@ -213,7 +213,7 @@ function DocumentListItem(props: Props) {
<Content>
<Heading dir={document.dir}>
<Title
text={document.titleWithDefault}
text={document.displayTitle}
highlight={highlight}
dir={document.dir}
/>
@@ -184,7 +184,7 @@ function SharedWithMeLink({ membership, depth = 0 }: Props) {
const label =
determineIconType(docIcon) === IconType.Emoji
? document.title.replace(docIcon!, "")
: document.titleWithDefault;
: document.displayTitle;
const collection = document.collectionId
? collections.get(document.collectionId)
: undefined;
@@ -222,7 +222,7 @@ const StarredDocumentLink = observer(function StarredDocumentLink({
depth={0}
icon={icon}
canEdit={can.update}
labelText={document.titleWithDefault}
labelText={document.displayTitle}
onTitleChange={handleTitleChange}
editableTitleRef={editableTitleRef}
expanded={expanded}
@@ -28,7 +28,7 @@ export function useSidebarLabelAndIcon({
const collection =
!document && collectionId ? collections.get(collectionId) : undefined;
const title = document?.titleWithDefault;
const title = document?.displayTitle;
const documentIcon = document?.icon;
const initial = document?.initial;
const color = document?.color;
+2 -5
View File
@@ -55,10 +55,7 @@ function useTemplateMenuItem(isActive: boolean): MenuItem | undefined {
const toMenuItem = (template: (typeof allTemplates)[0]): MenuItem => ({
name: "noop",
title: TextHelper.replaceTemplateVariables(
template.titleWithDefault,
user
),
title: TextHelper.replaceTemplateVariables(template.displayTitle, user),
icon: template.icon ? (
<Icon
value={template.icon}
@@ -68,7 +65,7 @@ function useTemplateMenuItem(isActive: boolean): MenuItem | undefined {
) : (
<DocumentIcon />
),
keywords: template.titleWithDefault,
keywords: template.displayTitle,
onClick: () => {
const data = cloneDeep(template.data);
ProsemirrorHelper.replaceTemplateVariables(data, user);
+2 -2
View File
@@ -149,7 +149,7 @@ export default class PasteHandler extends Extension {
state.schema.nodes.mention.create({
type: MentionType.Document,
modelId: document.id,
label: document.titleWithDefault,
label: document.displayTitle,
id: uuidv4(),
anchorId: trimmedHash.length
? trimmedHash
@@ -164,7 +164,7 @@ export default class PasteHandler extends Extension {
IconType.Emoji;
const title = `${hasEmoji ? document.icon + " " : ""}${
document.titleWithDefault
document.displayTitle
}`;
this.insertLink(`${document.path}${hash}`, title);
+1 -4
View File
@@ -47,10 +47,7 @@ export function useTemplateMenuActions({
const templateToAction = useCallback(
(template: Template): Action =>
createAction({
name: TextHelper.replaceTemplateVariables(
template.titleWithDefault,
user
),
name: TextHelper.replaceTemplateVariables(template.displayTitle, user),
section: DocumentsSection,
icon: template.icon ? (
<Icon
+2 -2
View File
@@ -50,7 +50,7 @@ function NewChildDocumentMenu({ document }: Props) {
<Trans
defaults="New document in <em>{{ collectionName }}</em>"
values={{
collectionName: document.titleWithDefault,
collectionName: document.displayTitle,
}}
components={{
em: <strong />,
@@ -66,7 +66,7 @@ function NewChildDocumentMenu({ document }: Props) {
collectionName,
canCollection.createDocument,
document.id,
document.titleWithDefault,
document.displayTitle,
document.collectionId,
]
);
+1 -1
View File
@@ -490,7 +490,7 @@ export default class Document extends ArchivableModel implements Searchable {
return path.map((item) => item.asNavigationNode);
}
get titleWithDefault(): string {
get displayTitle(): string {
return this.title || i18n.t("Untitled");
}
+2 -2
View File
@@ -185,13 +185,13 @@ export default class Template extends ParanoidModel implements Searchable {
return addDays(new Date(this.deletedAt), 30).toString();
}
get titleWithDefault(): string {
get displayTitle(): string {
return this.title || i18n.t("Untitled");
}
@computed
get initial(): string {
return (this.titleWithDefault?.charAt(0) ?? "?").toUpperCase();
return (this.displayTitle?.charAt(0) ?? "?").toUpperCase();
}
@computed
+2 -2
View File
@@ -371,8 +371,8 @@ function DocumentScene({
const hasEmojiInTitle = determineIconType(document.icon) === IconType.Emoji;
const pageTitle = hasEmojiInTitle
? document.titleWithDefault.replace(document.icon!, "")
: document.titleWithDefault;
? document.displayTitle.replace(document.icon!, "")
: document.displayTitle;
const favicon = hasEmojiInTitle ? emojiToUrl(document.icon!) : undefined;
const fullWidthTransformOffsetStyle = {
+1 -3
View File
@@ -227,9 +227,7 @@ function DocumentEditor(props: Props) {
readOnly={readOnly}
documentId={document.id}
title={
!document.title && readOnly
? document.titleWithDefault
: document.title
!document.title && readOnly ? document.displayTitle : document.title
}
icon={document.icon}
color={iconColor}
@@ -238,7 +238,7 @@ function ReferenceListItem({
const { icon, color } = document;
const isEmoji = determineIconType(icon) === IconType.Emoji;
const title =
document instanceof Document ? document.titleWithDefault : document.title;
document instanceof Document ? document.displayTitle : document.title;
const initial = title.charAt(0).toUpperCase();
const showContextMenu = document instanceof Document && !!user;
+2 -2
View File
@@ -109,7 +109,7 @@ function DocumentDelete({ document, onSubmit }: Props) {
<Trans
defaults="Are you sure about that? Deleting the <em>{{ documentTitle }}</em> document will delete all of its history."
values={{
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
}}
components={{
em: <strong />,
@@ -120,7 +120,7 @@ function DocumentDelete({ document, onSubmit }: Props) {
count={nestedDocumentsCount}
defaults="Are you sure about that? Deleting the <em>{{ documentTitle }}</em> document will delete all of its history and <em>{{ any }} nested document</em>."
values={{
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
any: nestedDocumentsCount,
}}
components={{
+1 -1
View File
@@ -37,7 +37,7 @@ function DocumentPermanentDelete({ document, onSubmit }: Props) {
<Trans
defaults="Are you sure you want to permanently delete the <em>{{ documentTitle }}</em> document? This action is immediate and cannot be undone."
values={{
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
}}
components={{
em: <strong />,
@@ -19,7 +19,7 @@ export function DocumentFilter(props: Props) {
<div>
<Tooltip content={t("Remove document filter")}>
<StyledButton onClick={props.onClick} icon={<CloseIcon />} neutral>
{props.document.titleWithDefault}
{props.document.displayTitle}
</StyledButton>
</Tooltip>
</div>
@@ -89,7 +89,7 @@ export function TemplatesTable(props: Props) {
type: "data",
id: "title",
header: t("Title"),
accessor: (template) => template.titleWithDefault,
accessor: (template) => template.displayTitle,
component: (template) => <TemplateLink template={template} />,
width: "4fr",
},
@@ -167,9 +167,9 @@ const TemplateLink = observer(({ template }: { template: Template }) => {
<ShapesIcon size={24} color={theme.textSecondary} />
)}
{can.update ? (
<Title>{template.titleWithDefault}</Title>
<Title>{template.displayTitle}</Title>
) : (
<Text>{template.titleWithDefault}</Text>
<Text>{template.displayTitle}</Text>
)}
{template.isDraft && (
<Tooltip content={t("Only visible to you")} placement="top">
+1 -1
View File
@@ -130,7 +130,7 @@ class UiStore {
setPresentingDocument = (document: Document | null): void => {
this.presentationData = document
? {
title: document.titleWithDefault,
title: document.displayTitle,
icon: document.icon,
color: document.color,
data: document.data,
@@ -22,7 +22,7 @@ export function presentMessageAttachment(
return {
color: collection?.color,
title: document.titleWithDefault,
title: document.displayTitle,
title_link: `${team.url}${document.url}`,
footer: collection?.name,
callback_id: document.id,
@@ -124,10 +124,10 @@ export default class SlackProcessor extends BaseProcessor {
if (!integration) {
return;
}
let text = `${document.updatedBy.name} updated "${document.titleWithDefault}"`;
let text = `${document.updatedBy.name} updated "${document.displayTitle}"`;
if (event.name === "documents.publish") {
text = `${document.createdBy.name} published "${document.titleWithDefault}"`;
text = `${document.createdBy.name} published "${document.displayTitle}"`;
}
await fetch(integration.settings.url, {
@@ -106,7 +106,7 @@ export default class CommentCreatedEmail extends BaseEmail<
return `${parentComment ? this.t("Re") + ": " : ""}${this.t(
"New comment on “{{ documentTitle }}” - {{ trimmedText }}",
{ documentTitle: document.titleWithDefault, trimmedText }
{ documentTitle: document.displayTitle, trimmedText }
)}`;
}
@@ -140,11 +140,11 @@ export default class CommentCreatedEmail extends BaseEmail<
const action = isReply
? this.t("{{ actorName }} replied to a thread in “{{ documentTitle }}”", {
actorName,
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
})
: this.t("{{ actorName }} commented on “{{ documentTitle }}”", {
actorName,
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
});
const inCollection = collection?.name
? ` ${this.t("in the {{ collectionName }} collection", { collectionName: collection.name })}`
@@ -178,12 +178,12 @@ ${this.t("Open Thread")}: ${teamUrl}${document.url}?commentId=${commentId}
<Header />
<Body>
<Heading>{document.titleWithDefault}</Heading>
<Heading>{document.displayTitle}</Heading>
<p>
{isReply
? this.t("{{ actorName }} replied to a thread in", { actorName })
: this.t("{{ actorName }} commented on", { actorName })}{" "}
<a href={threadLink}>{document.titleWithDefault}</a>{" "}
<a href={threadLink}>{document.displayTitle}</a>{" "}
{collection?.name
? this.t("in the {{ collectionName }} collection", {
collectionName: collection.name,
@@ -95,7 +95,7 @@ export default class CommentMentionedEmail extends BaseEmail<
protected subject({ document }: Props) {
return this.t("Mentioned you in “{{ documentTitle }}”", {
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
});
}
@@ -116,7 +116,7 @@ export default class CommentMentionedEmail extends BaseEmail<
}: Props): string {
const action = this.t(
"{{ actorName }} mentioned you in a comment on “{{ documentTitle }}”",
{ actorName, documentTitle: document.titleWithDefault }
{ actorName, documentTitle: document.displayTitle }
);
const inCollection = collection.name
? ` ${this.t("in the {{ collectionName }} collection", { collectionName: collection.name })}`
@@ -149,12 +149,12 @@ ${this.t("Open Thread")}: ${teamUrl}${document.url}?commentId=${commentId}
<Header />
<Body>
<Heading>{document.titleWithDefault}</Heading>
<Heading>{document.displayTitle}</Heading>
<p>
{this.t("{{ actorName }} mentioned you in a comment on", {
actorName,
})}{" "}
<a href={threadLink}>{document.titleWithDefault}</a>{" "}
<a href={threadLink}>{document.displayTitle}</a>{" "}
{collection.name
? this.t("in the {{ collectionName }} collection", {
collectionName: collection.name,
@@ -95,7 +95,7 @@ export default class CommentResolvedEmail extends BaseEmail<
protected subject({ document }: Props) {
return this.t("Resolved a comment thread in “{{ documentTitle }}”", {
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
});
}
@@ -116,7 +116,7 @@ export default class CommentResolvedEmail extends BaseEmail<
}: Props): string {
const action = this.t(
"{{ actorName }} resolved a comment thread on “{{ documentTitle }}”",
{ actorName, documentTitle: document.titleWithDefault }
{ actorName, documentTitle: document.displayTitle }
);
const inCollection = collection.name
? ` ${this.t("in the {{ collectionName }} collection", { collectionName: collection.name })}`
@@ -145,10 +145,10 @@ export default class CommentResolvedEmail extends BaseEmail<
<Header />
<Body>
<Heading>{document.titleWithDefault}</Heading>
<Heading>{document.displayTitle}</Heading>
<p>
{this.t("{{ actorName }} resolved a comment on", { actorName })}{" "}
<a href={threadLink}>{document.titleWithDefault}</a>{" "}
<a href={threadLink}>{document.displayTitle}</a>{" "}
{collection.name
? this.t("in the {{ collectionName }} collection", {
collectionName: collection.name,
@@ -47,7 +47,7 @@ export default class DocumentAccessRequestEmail extends BaseEmail<
}
protected subject({ actor, document }: Props) {
return `${actor.name} is requesting access to "${document.titleWithDefault}"`;
return `${actor.name} is requesting access to "${document.displayTitle}"`;
}
protected preview({ actor }: Props): string {
@@ -60,7 +60,7 @@ export default class DocumentAccessRequestEmail extends BaseEmail<
protected renderAsText({ actor, teamUrl, document }: Props): string {
return `
${actor.name} is requesting access to "${document.titleWithDefault}".
${actor.name} is requesting access to "${document.displayTitle}".
Open the document to share it with them: ${teamUrl}${document.path}
`;
@@ -78,10 +78,10 @@ Open the document to share it with them: ${teamUrl}${document.path}
<Header />
<Body>
<Heading>{document.titleWithDefault}</Heading>
<Heading>{document.displayTitle}</Heading>
<p>
{actor.name} is requesting access to the{" "}
<a href={documentUrl}>{document.titleWithDefault}</a> document.
<a href={documentUrl}>{document.displayTitle}</a> document.
</p>
<p>Open the document to share it with them.</p>
<p>
@@ -94,7 +94,7 @@ export default class DocumentMentionedEmail extends BaseEmail<
protected subject({ document }: Props) {
return this.t(`Mentioned you in “{{ documentTitle }}”`, {
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
});
}
@@ -119,7 +119,7 @@ export default class DocumentMentionedEmail extends BaseEmail<
return `
${this.t("You were mentioned")}
${this.t(`{{ actorName }} mentioned you in the document “{{ documentTitle }}”.`, { actorName, documentTitle: document.titleWithDefault })}
${this.t(`{{ actorName }} mentioned you in the document “{{ documentTitle }}”.`, { actorName, documentTitle: document.displayTitle })}
${this.t("Open Document")}: ${teamUrl}${document.url}
`;
@@ -142,7 +142,7 @@ ${this.t("Open Document")}: ${teamUrl}${document.url}
{this.t("{{ actorName }} mentioned you in the document", {
actorName,
})}{" "}
<a href={documentLink}>{document.titleWithDefault}</a>.
<a href={documentLink}>{document.displayTitle}</a>.
</p>
{body && (
<>
@@ -118,7 +118,7 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail<
protected subject({ document, eventType }: Props) {
return this.t(`“{{ documentTitle }}” {{ eventName }}`, {
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
eventName: this.eventName(eventType),
});
}
@@ -153,9 +153,9 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail<
const eventName = this.eventName(eventType);
return `
${this.t("“{{ documentTitle }}” {{ eventName }}", { documentTitle: document.titleWithDefault, eventName })}
${this.t("“{{ documentTitle }}” {{ eventName }}", { documentTitle: document.displayTitle, eventName })}
${this.t("{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”", { actorName, eventName, documentTitle: document.titleWithDefault })}${
${this.t("{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”", { actorName, eventName, documentTitle: document.displayTitle })}${
collection?.name
? `, ${this.t("in the {{ collectionName }} collection", { collectionName: collection.name })}`
: ""
@@ -188,7 +188,7 @@ ${this.t("Open Document")}: ${teamUrl}${document.url}
<Body>
<Heading>
{this.t(`“{{ documentTitle }}” {{ eventName }}`, {
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
eventName,
})}
</Heading>
@@ -197,7 +197,7 @@ ${this.t("Open Document")}: ${teamUrl}${document.url}
actorName,
eventName,
})}{" "}
<a href={documentLink}>{document.titleWithDefault}</a>
<a href={documentLink}>{document.displayTitle}</a>
{collection?.name ? (
<>
,{" "}
@@ -59,7 +59,7 @@ export default class DocumentSharedEmail extends BaseEmail<
protected subject({ actorName, document }: Props) {
return this.t(`{{ actorName }} shared “{{ documentTitle }}” with you`, {
actorName,
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
});
}
@@ -73,7 +73,7 @@ export default class DocumentSharedEmail extends BaseEmail<
protected renderAsText({ actorName, teamUrl, document }: Props): string {
return `
${this.t(`{{ actorName }} shared “{{ documentTitle }}” with you.`, { actorName, documentTitle: document.titleWithDefault })}
${this.t(`{{ actorName }} shared “{{ documentTitle }}” with you.`, { actorName, documentTitle: document.displayTitle })}
${this.t("View Document")}: ${teamUrl}${document.path}
`;
@@ -96,13 +96,13 @@ ${this.t("View Document")}: ${teamUrl}${document.path}
<Header />
<Body>
<Heading>{document.titleWithDefault}</Heading>
<Heading>{document.displayTitle}</Heading>
<p>
{this.t("{{ actorName }} invited you to {{ permission }} the", {
actorName,
permission,
})}{" "}
<a href={documentUrl}>{document.titleWithDefault}</a>{" "}
<a href={documentUrl}>{document.displayTitle}</a>{" "}
{this.t("document")}.
</p>
<p>
@@ -104,7 +104,7 @@ export default class GroupCommentMentionedEmail extends BaseEmail<
protected subject({ document, groupName }: Props) {
return this.t(
"The {{ groupName }} group was mentioned in “{{ documentTitle }}”",
{ groupName, documentTitle: document.titleWithDefault }
{ groupName, documentTitle: document.displayTitle }
);
}
@@ -129,7 +129,7 @@ export default class GroupCommentMentionedEmail extends BaseEmail<
}: Props): string {
const action = this.t(
"{{ actorName }} mentioned the “{{ groupName }}” group in a comment on “{{ documentTitle }}”",
{ actorName, groupName, documentTitle: document.titleWithDefault }
{ actorName, groupName, documentTitle: document.displayTitle }
);
const inCollection = collection.name
? ` ${this.t("in the {{ collectionName }} collection", { collectionName: collection.name })}`
@@ -163,13 +163,13 @@ ${this.t("Open Thread")}: ${teamUrl}${document.url}?commentId=${commentId}
<Header />
<Body>
<Heading>{document.titleWithDefault}</Heading>
<Heading>{document.displayTitle}</Heading>
<p>
{this.t(
"{{ actorName }} mentioned the “{{ groupName }}” group in a comment on",
{ actorName, groupName }
)}{" "}
<a href={threadLink}>{document.titleWithDefault}</a>{" "}
<a href={threadLink}>{document.displayTitle}</a>{" "}
{collection.name
? this.t("in the {{ collectionName }} collection", {
collectionName: collection.name,
@@ -103,7 +103,7 @@ export default class GroupDocumentMentionedEmail extends BaseEmail<
`The {{ groupName }} group was mentioned in “{{ documentTitle }}”`,
{
groupName,
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
}
);
}
@@ -135,7 +135,7 @@ export default class GroupDocumentMentionedEmail extends BaseEmail<
groupName,
}: Props): string {
return `
${this.t(`{{ actorName }} mentioned the “{{ groupName }}” group in the document “{{ documentTitle }}”.`, { actorName, groupName, documentTitle: document.titleWithDefault })}
${this.t(`{{ actorName }} mentioned the “{{ groupName }}” group in the document “{{ documentTitle }}”.`, { actorName, groupName, documentTitle: document.displayTitle })}
${this.t("Open Document")}: ${teamUrl}${document.url}
`;
@@ -159,7 +159,7 @@ ${this.t("Open Document")}: ${teamUrl}${document.url}
"{{ actorName }} mentioned the “{{ groupName }}” group in the document",
{ actorName, groupName }
)}{" "}
<a href={documentLink}>{document.titleWithDefault}</a>.
<a href={documentLink}>{document.displayTitle}</a>.
</p>
{body && (
<>
+1 -1
View File
@@ -1107,7 +1107,7 @@ class Document extends ArchivableModel<
*
* @returns boolean
*/
get titleWithDefault(): string {
get displayTitle(): string {
return this.title || "Untitled";
}
+1 -1
View File
@@ -178,7 +178,7 @@ class FileOperation extends ParanoidModel<
const source =
"document" in options
? {
name: options.document.titleWithDefault,
name: options.document.displayTitle,
documentId: options.document.id,
teamId: options.document.teamId,
options: personalOwnerId ? { personalOwnerId } : null,
+1 -1
View File
@@ -63,7 +63,7 @@ export default class OKFHelper {
const data: Frontmatter = {
type: this.conceptType,
title: document.titleWithDefault,
title: document.displayTitle,
...(description ? { description } : {}),
resource: `${origin}${document.path}`,
status: this.status(document),
+1 -1
View File
@@ -9,7 +9,7 @@ export default function presentFileOperation(data: FileOperation) {
format: data.format,
name:
data.collection?.name ||
data.document?.titleWithDefault ||
data.document?.displayTitle ||
path.basename(data.key || ""),
state: data.state,
error: data.error,
+1 -1
View File
@@ -114,7 +114,7 @@ const presentDocument = (
url: url ?? `${document.url}${anchor ?? ""}`,
type: UnfurlResourceType.Document,
id: document.id,
title: document.titleWithDefault,
title: document.displayTitle,
summary: sectionSummary || document.getSummary(),
lastActivityByViewer: viewer
? presentLastActivityInfoFor(document, viewer)
@@ -289,7 +289,7 @@ export default abstract class ExportDocumentTreeTask extends ExportTask {
}) {
const pathMap = new Map<string, string>();
const rootFolderName = serializeFilename(document.titleWithDefault);
const rootFolderName = serializeFilename(document.displayTitle);
const rootPath = `${rootFolderName}.${ExportDocumentTreeTask.extensionForFormat(format)}`;
// entry for root document
@@ -317,7 +317,7 @@ export default abstract class ExportDocumentTreeTask extends ExportTask {
Buffer.from(
OKFHelper.rootIndex("Documents", [
{
title: document.titleWithDefault,
title: document.displayTitle,
path: rootPath,
description: document.getSummary(),
},
@@ -72,7 +72,7 @@ export default class ShareSubscriptionNotificationsTask extends BaseTask<Revisio
await new ShareDocumentUpdatedEmail({
to: subscription.email,
shareSubscriptionId: subscription.id,
documentTitle: document.titleWithDefault,
documentTitle: document.displayTitle,
shareUrl,
revisionId: event.modelId,
}).schedule();
+1 -1
View File
@@ -1055,7 +1055,7 @@ router.post(
const extension =
contentType === "text/markdown" ? "md" : mime.extension(contentType);
const fileName = slugify(document.titleWithDefault);
const fileName = slugify(document.displayTitle);
const attachmentIds = ProsemirrorHelper.parseAttachmentIds(
DocumentHelper.toProsemirror(document)
);
+1 -1
View File
@@ -554,7 +554,7 @@ router.post(
share.team?.getPreference(TeamPreference.PublicBranding) ?? false;
await new ShareSubscriptionConfirmEmail({
to: email,
documentTitle: document?.titleWithDefault ?? "",
documentTitle: document?.displayTitle ?? "",
confirmUrl,
teamName: usePublicBranding ? share.team?.name : undefined,
}).schedule();
+4 -4
View File
@@ -226,7 +226,7 @@ describe("#urls.unfurl", () => {
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.type).toEqual(UnfurlResourceType.Document);
expect(body.title).toEqual(document.titleWithDefault);
expect(body.title).toEqual(document.displayTitle);
expect(body.id).toEqual(document.id);
});
@@ -348,7 +348,7 @@ Install instructions here.`
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.type).toEqual(UnfurlResourceType.Document);
expect(body.title).toEqual(document.titleWithDefault);
expect(body.title).toEqual(document.displayTitle);
expect(body.id).toEqual(document.id);
});
@@ -372,7 +372,7 @@ Install instructions here.`
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.type).toEqual(UnfurlResourceType.Document);
expect(body.title).toEqual(document.titleWithDefault);
expect(body.title).toEqual(document.displayTitle);
expect(body.id).toEqual(document.id);
});
@@ -395,7 +395,7 @@ Install instructions here.`
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.type).toEqual(UnfurlResourceType.Document);
expect(body.title).toEqual(document.titleWithDefault);
expect(body.title).toEqual(document.displayTitle);
expect(body.id).toEqual(document.id);
});