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

Make sure only future events are shown on homepage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-15 11:29:45 +02:00
parent 5ebbb57d0e
commit 4d8bad7088
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -117,6 +117,7 @@ import { IConfig } from '@/types/config.model';
events: {
query: FETCH_EVENTS,
fetchPolicy: 'no-cache', // Debug me: https://github.com/apollographql/apollo-client/issues/3030
update: data => data.events.map(event => new EventModel(event)),
},
currentActor: {
query: CURRENT_ACTOR_CLIENT,
@ -250,8 +251,10 @@ export default class Home extends Vue {
}
get filteredFeaturedEvents() {
if (!this.currentUser.isLoggedIn || !this.currentActor.id) return this.events;
return this.events.filter(event => event.organizerActor && event.organizerActor.id !== this.currentActor.id);
if (!this.currentUser.isLoggedIn || !this.currentActor.id) return this.events.filter((event: IEvent) => event.beginsOn > new Date());
return this.events.filter(event => event.organizerActor &&
event.organizerActor.id !== this.currentActor.id &&
event.beginsOn > new Date());
}
geoLocalize() {