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:
@@ -13,6 +13,9 @@ export const COMMENT_FIELDS_FRAGMENT = gql`
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
totalReplies
|
||||
insertedAt
|
||||
updatedAt
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface IConversation {
|
||||
id?: string;
|
||||
actor?: IActor;
|
||||
lastComment?: IComment;
|
||||
originComment?: IComment;
|
||||
comments: Paginate<IComment>;
|
||||
participants: IActor[];
|
||||
updatedAt: string;
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user