From 69e4a5c53224e65aa7dbc1f3b257fc002eb1a599 Mon Sep 17 00:00:00 2001 From: summersamara Date: Tue, 21 Nov 2023 22:26:39 +0100 Subject: [PATCH 1/2] fix: don't show passed/finished events in related events section --- src/graphql/event.ts | 1 + src/views/Event/EventView.vue | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/graphql/event.ts b/src/graphql/event.ts index ee2f7ed9..3e0781ce 100644 --- a/src/graphql/event.ts +++ b/src/graphql/event.ts @@ -64,6 +64,7 @@ const FULL_EVENT_FRAGMENT = gql` uuid title beginsOn + endsOn status language picture { diff --git a/src/views/Event/EventView.vue b/src/views/Event/EventView.vue index 9f79acdb..15750628 100755 --- a/src/views/Event/EventView.vue +++ b/src/views/Event/EventView.vue @@ -243,12 +243,12 @@

{{ t("These events may interest you") }}

- +
import("@/components/Event/Integrations/TwitchIntegration.vue") @@ -611,6 +612,19 @@ const organizerDomain = computed((): string | undefined => { return organizer.value?.domain ?? undefined; }); +const filterNonPassedRelatedEvents = (relatedEvents: IEvent[] | undefined) => { + return relatedEvents?.filter((relatedEvent) => { + const endsOn = relatedEvent.endsOn + ? new Date(relatedEvent.endsOn) + : new Date(relatedEvent.beginsOn); + return endsOn > new Date(); + }); +}; + +const nonPassedRelatedEvents = computed((): IEvent[] | undefined => { + return filterNonPassedRelatedEvents(event.value?.relatedEvents); +}); + useHead({ title: computed(() => eventTitle.value ?? ""), meta: [{ name: "description", content: eventDescription.value }], From 8a1b1227113547583708dbd0c3b59c15c6a8e340 Mon Sep 17 00:00:00 2001 From: summersamara Date: Wed, 22 Nov 2023 16:45:43 +0100 Subject: [PATCH 2/2] remove unnecessary function --- src/views/Event/EventView.vue | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/views/Event/EventView.vue b/src/views/Event/EventView.vue index 15750628..ab32c301 100755 --- a/src/views/Event/EventView.vue +++ b/src/views/Event/EventView.vue @@ -612,17 +612,15 @@ const organizerDomain = computed((): string | undefined => { return organizer.value?.domain ?? undefined; }); -const filterNonPassedRelatedEvents = (relatedEvents: IEvent[] | undefined) => { - return relatedEvents?.filter((relatedEvent) => { +const nonPassedRelatedEvents = computed((): IEvent[] | undefined => { + let relatedEvents = event.value?.relatedEvents; + + return relatedEvents?.filter((relatedEvent: IEvent) => { const endsOn = relatedEvent.endsOn ? new Date(relatedEvent.endsOn) : new Date(relatedEvent.beginsOn); return endsOn > new Date(); }); -}; - -const nonPassedRelatedEvents = computed((): IEvent[] | undefined => { - return filterNonPassedRelatedEvents(event.value?.relatedEvents); }); useHead({