fix: Account for createdBy, updatedBy being undefined. closes #6578
This commit is contained in:
@@ -123,7 +123,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
componentWillUnmount() {
|
||||
if (
|
||||
this.isEmpty &&
|
||||
this.props.document.createdBy.id === this.props.auth.user?.id &&
|
||||
this.props.document.createdBy?.id === this.props.auth.user?.id &&
|
||||
this.props.document.isDraft &&
|
||||
this.props.document.isActive &&
|
||||
this.props.document.hasEmptyTitle &&
|
||||
|
||||
@@ -115,9 +115,9 @@ function Insights() {
|
||||
title={model.name}
|
||||
image={<Avatar model={model} size={32} />}
|
||||
subtitle={
|
||||
model.id === document.createdBy.id
|
||||
model.id === document.createdBy?.id
|
||||
? t("Creator")
|
||||
: model.id === document.updatedBy.id
|
||||
: model.id === document.updatedBy?.id
|
||||
? t("Last edited")
|
||||
: t("Previously edited")
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function Notices({ document, readOnly }: Props) {
|
||||
{document.archivedAt && !document.deletedAt && (
|
||||
<Notice icon={<ArchiveIcon />}>
|
||||
{t("Archived by {{userName}}", {
|
||||
userName: document.updatedBy.name,
|
||||
userName: document.updatedBy?.name ?? t("Unknown"),
|
||||
})}
|
||||
|
||||
<Time dateTime={document.updatedAt} addSuffix />
|
||||
@@ -77,7 +77,7 @@ export default function Notices({ document, readOnly }: Props) {
|
||||
description={permanentlyDeletedDescription()}
|
||||
>
|
||||
{t("Deleted by {{userName}}", {
|
||||
userName: document.updatedBy.name,
|
||||
userName: document.updatedBy?.name ?? t("Unknown"),
|
||||
})}
|
||||
|
||||
<Time dateTime={document.deletedAt} addSuffix />
|
||||
|
||||
Reference in New Issue
Block a user