fix(announcements): make sure only valid announcements are shown to the user

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2024-01-05 17:51:41 +01:00
parent dcbb8eae01
commit c9a1c35aa7
8 changed files with 95 additions and 4 deletions

View File

@@ -13,6 +13,9 @@ export const COMMENT_FIELDS_FRAGMENT = gql`
actor {
...ActorFragment
}
attributedTo {
...ActorFragment
}
totalReplies
insertedAt
updatedAt

View File

@@ -12,6 +12,9 @@ export const CONVERSATION_QUERY_FRAGMENT = gql`
lastComment {
...CommentFields
}
originComment {
...CommentFields
}
participants {
...ActorFragment
}
@@ -19,6 +22,12 @@ export const CONVERSATION_QUERY_FRAGMENT = gql`
id
uuid
title
organizerActor {
id
}
attributedTo {
id
}
picture {
id
url

View File

@@ -8,6 +8,7 @@ export interface IConversation {
id?: string;
actor?: IActor;
lastComment?: IComment;
originComment?: IComment;
comments: Paginate<IComment>;
participants: IActor[];
updatedAt: string;

View File

@@ -14,7 +14,11 @@
]"
/>
<div
v-if="conversation.event && !isCurrentActorAuthor"
v-if="
conversation.event &&
!isCurrentActorAuthor &&
isOriginCommentAuthorEventOrganizer
"
class="bg-mbz-yellow p-6 mb-3 rounded flex gap-2 items-center"
>
<Calendar :size="36" />
@@ -132,7 +136,11 @@
>
</form>
<div
v-else-if="conversation.event"
v-else-if="
conversation.event &&
!isCurrentActorAuthor &&
isOriginCommentAuthorEventOrganizer
"
class="bg-mbz-yellow p-6 rounded flex gap-2 items-center mt-3"
>
<Calendar :size="36" />
@@ -292,6 +300,16 @@ const isCurrentActorAuthor = computed(
currentActor.value.id !== conversation.value?.actor?.id
);
const isOriginCommentAuthorEventOrganizer = computed(
() =>
conversation.value?.originComment?.actor &&
conversation.value?.event &&
[
conversation.value?.event?.organizerActor?.id,
conversation.value?.event?.attributedTo?.id,
].includes(conversation.value?.originComment?.actor.id)
);
useHead({
title: () => title.value,
});