If a document is created within a collection, publish it automatically. (#7243)

* If a document is created within a collection, publish it automatically.

* automatically publish from app, not server

* remove auto publish from server

* New draft -> New doc
This commit is contained in:
feingold-ant
2024-07-15 19:56:43 -04:00
committed by GitHub
parent e3d7fba239
commit e2213dbfa2

View File

@@ -41,17 +41,21 @@ function DocumentNew({ template }: Props) {
if (id) {
collection = await collections.fetch(id);
}
const document = await documents.create({
collectionId: collection?.id,
parentDocumentId,
fullWidth:
parentDocument?.fullWidth ||
user.getPreference(UserPreference.FullWidthDocuments),
templateId: query.get("templateId") ?? undefined,
template,
title: "",
data: ProsemirrorHelper.getEmptyDocument(),
});
const document = await documents.create(
{
collectionId: collection?.id,
parentDocumentId,
fullWidth:
parentDocument?.fullWidth ||
user.getPreference(UserPreference.FullWidthDocuments),
templateId: query.get("templateId") ?? undefined,
template,
title: "",
data: ProsemirrorHelper.getEmptyDocument(),
},
{ publish: collection?.id || parentDocumentId ? true : undefined }
);
history.replace(
template || !user.separateEditMode
? documentPath(document)