[IMP] move filtering of past events in related events section to backend
This commit is contained in:
parent
baf75dd890
commit
9670b77bc3
|
@ -1774,6 +1774,7 @@ defmodule Mobilizon.Events do
|
||||||
|> distinct([e], e.id)
|
|> distinct([e], e.id)
|
||||||
|> join(:left, [e], et in "events_tags", on: e.id == et.event_id)
|
|> join(:left, [e], et in "events_tags", on: e.id == et.event_id)
|
||||||
|> join(:left, [e], a in Address, on: e.physical_address_id == a.id)
|
|> join(:left, [e], a in Address, on: e.physical_address_id == a.id)
|
||||||
|
|> filter_future_events(true)
|
||||||
|> filter_draft()
|
|> filter_draft()
|
||||||
|> filter_local_or_from_followed_instances_events()
|
|> filter_local_or_from_followed_instances_events()
|
||||||
|> filter_public_visibility()
|
|> filter_public_visibility()
|
||||||
|
|
|
@ -243,12 +243,12 @@
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="bg-white dark:bg-zinc-700 px-3 pt-1 pb-3 rounded my-4"
|
class="bg-white dark:bg-zinc-700 px-3 pt-1 pb-3 rounded my-4"
|
||||||
v-if="(nonPassedRelatedEvents ?? []).length > 0"
|
v-if="(event?.relatedEvents ?? []).length > 0"
|
||||||
>
|
>
|
||||||
<h2 class="text-2xl mb-2">
|
<h2 class="text-2xl mb-2">
|
||||||
{{ t("These events may interest you") }}
|
{{ t("These events may interest you") }}
|
||||||
</h2>
|
</h2>
|
||||||
<multi-card :events="nonPassedRelatedEvents ?? []" />
|
<multi-card :events="event?.relatedEvents ?? []" />
|
||||||
</section>
|
</section>
|
||||||
<o-modal
|
<o-modal
|
||||||
v-model:active="showMap"
|
v-model:active="showMap"
|
||||||
|
@ -612,17 +612,6 @@ const organizerDomain = computed((): string | undefined => {
|
||||||
return organizer.value?.domain ?? undefined;
|
return organizer.value?.domain ?? undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
const nonPassedRelatedEvents = computed((): IEvent[] | undefined => {
|
|
||||||
const 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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: computed(() => eventTitle.value ?? ""),
|
title: computed(() => eventTitle.value ?? ""),
|
||||||
meta: [{ name: "description", content: eventDescription.value }],
|
meta: [{ name: "description", content: eventDescription.value }],
|
||||||
|
|
Loading…
Reference in a new issue