From 64af148c7e812e085c2ece54937356e5af39ed9f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 21 Jul 2021 12:02:14 +0200 Subject: [PATCH] Hide drafts and visibility limited content on group public preview page Closes #775 Signed-off-by: Thomas Citharel --- js/src/types/actor/group.model.ts | 1 + js/src/views/Group/Group.vue | 43 +++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/js/src/types/actor/group.model.ts b/js/src/types/actor/group.model.ts index 7c90eeff4..6f6a2b073 100644 --- a/js/src/types/actor/group.model.ts +++ b/js/src/types/actor/group.model.ts @@ -18,6 +18,7 @@ export interface IGroup extends IActor { todoLists: Paginate; discussions: Paginate; organizedEvents: Paginate; + posts: Paginate; physicalAddress: IAddress; openness: Openness; visibility: GroupVisibility; diff --git a/js/src/views/Group/Group.vue b/js/src/views/Group/Group.vue index a36048337..e86923e1c 100644 --- a/js/src/views/Group/Group.vue +++ b/js/src/views/Group/Group.vue @@ -473,10 +473,10 @@ {{ $t("Upcoming events") }}
{{ $t("View all events") }}
{{ $t("Latest posts") }} -
+
@@ -510,7 +510,7 @@ { + return { + total: this.group.organizedEvents.total, + elements: this.group.organizedEvents.elements.filter((event: IEvent) => { + if (this.previewPublic) { + return !event.draft; // TODO when events get visibility access add visibility constraint like below for posts + } + return true; + }), + }; + } + + get posts(): Paginate { + return { + total: this.group.posts.total, + elements: this.group.posts.elements.filter((post: IPost) => { + if (this.previewPublic) { + return !(post.draft || post.visibility == PostVisibility.PRIVATE); + } + return true; + }), + }; + } }