From 9bbbdea5e7b8cfa89a7d7f6ade1562a2f0495da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Weing=C3=A4rtner?= Date: Sun, 11 Aug 2024 20:41:52 +0100 Subject: [PATCH] fix: properly set ownership for private posts on entities Fixes #139 --- src/foundry/PageFactory.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/foundry/PageFactory.ts b/src/foundry/PageFactory.ts index 273bfd6..2c3b0cb 100644 --- a/src/foundry/PageFactory.ts +++ b/src/foundry/PageFactory.ts @@ -171,7 +171,7 @@ export default class PageFactory { ); } - private createPostPage(name: string, content: string | null | undefined) { + private createPostPage(name: string, content: string | null | undefined, isSecret: boolean) { if (!content) { return null; } @@ -180,7 +180,7 @@ export default class PageFactory { 'post', name, this.entity, - undefined, + { publicCount: isSecret ? 0 : 1 }, { show: true, level: 2 }, { text: { content } }, 'kanka-foundry.PostPageSheet', @@ -199,11 +199,11 @@ export default class PageFactory { return [ ...prePosts.map((note) => - this.createPostPage(note.name, note.entry_parsed) + this.createPostPage(note.name, note.entry_parsed, isSecret(note)) ), - this.createPostPage('KANKA.journal.shared.pages.entry', this.entity.entry_parsed), + this.createPostPage('KANKA.journal.shared.pages.entry', this.entity.entry_parsed, false), ...postPosts.map((note) => - this.createPostPage(note.name, note.entry_parsed) + this.createPostPage(note.name, note.entry_parsed, isSecret(note)) ), ]; } @@ -370,4 +370,4 @@ export default class PageFactory { this.getCounts(this.entity.children.map(m => ({ id: m })), 'id', this.type), ); } -} \ No newline at end of file +}