1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 07:52:43 +00:00

Remove last week's events from homepage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-10-25 18:43:46 +02:00
parent 6cdc68e1a8
commit 2a9098975d
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -243,26 +243,7 @@
<hr <hr
role="presentation" role="presentation"
class="home-separator" class="home-separator"
v-if="canShowMyUpcomingEvents && canShowLastWeekEvents" v-if="canShowMyUpcomingEvents && canShowCloseEvents"
/>
<!-- Last week events -->
<section v-if="canShowLastWeekEvents">
<h2 class="title">{{ $t("Last week") }}</h2>
<b-loading :active.sync="$apollo.loading" />
<div>
<EventListCard
v-for="participation in lastWeekEvents"
:key="participation.id"
:participation="participation"
@event-deleted="eventDeleted"
:options="{ hideDate: false }"
/>
</div>
</section>
<hr
role="presentation"
class="home-separator"
v-if="canShowLastWeekEvents && canShowCloseEvents"
/> />
<!-- Events close to you --> <!-- Events close to you -->
<section class="events-close" v-if="canShowCloseEvents"> <section class="events-close" v-if="canShowCloseEvents">
@ -301,9 +282,7 @@
<hr <hr
role="presentation" role="presentation"
class="home-separator" class="home-separator"
v-if=" v-if="canShowMyUpcomingEvents || canShowCloseEvents"
canShowMyUpcomingEvents || canShowLastWeekEvents || canShowCloseEvents
"
/> />
<section class="events-recent"> <section class="events-recent">
<h2 class="title"> <h2 class="title">
@ -334,7 +313,7 @@
</div> </div>
<b-message v-else type="is-danger" <b-message v-else type="is-danger"
>{{ $t("No events found") }}<br /> >{{ $t("No events found") }}<br />
<div v-if="goingToEvents.size > 0 || lastWeekEvents.length > 0"> <div v-if="goingToEvents.size > 0">
<b-icon size="is-small" icon="information-outline" /> <b-icon size="is-small" icon="information-outline" />
<small>{{ <small>{{
$t("The events you created are not shown here.") $t("The events you created are not shown here.")
@ -400,10 +379,8 @@ import Subtitle from "../components/Utils/Subtitle.vue";
query: LOGGED_USER_PARTICIPATIONS, query: LOGGED_USER_PARTICIPATIONS,
fetchPolicy: "cache-and-network", fetchPolicy: "cache-and-network",
variables() { variables() {
const lastWeek = new Date();
lastWeek.setDate(new Date().getDate() - 7);
return { return {
afterDateTime: lastWeek.toISOString(), afterDateTime: new Date().toISOString(),
}; };
}, },
update: (data) => update: (data) =>
@ -584,20 +561,6 @@ export default class Home extends Vue {
); );
} }
get lastWeekEvents(): IParticipant[] {
const res = this.currentUserParticipations.filter(
({ event, role }) =>
event.beginsOn != null &&
this.isBefore(event.beginsOn.toDateString(), 0) &&
role !== ParticipantRole.REJECTED
);
res.sort(
(a: IParticipant, b: IParticipant) =>
a.event.beginsOn.getTime() - b.event.beginsOn.getTime()
);
return res;
}
eventDeleted(eventid: string): void { eventDeleted(eventid: string): void {
this.currentUserParticipations = this.currentUserParticipations.filter( this.currentUserParticipations = this.currentUserParticipations.filter(
(participation) => participation.event.id !== eventid (participation) => participation.event.id !== eventid
@ -622,10 +585,6 @@ export default class Home extends Vue {
return this.currentActor.id != undefined && this.goingToEvents.size > 0; return this.currentActor.id != undefined && this.goingToEvents.size > 0;
} }
get canShowLastWeekEvents(): boolean {
return this.currentActor && this.lastWeekEvents.length > 0;
}
get canShowCloseEvents(): boolean { get canShowCloseEvents(): boolean {
return this.closeEvents.total > 0; return this.closeEvents.total > 0;
} }