Fix events not showing on homepage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-01-12 16:31:09 +01:00
parent 0b8538a65b
commit 24461be703
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
3 changed files with 17 additions and 8 deletions

View file

@ -823,5 +823,6 @@
"Do you wish to {create_group} or {explore_groups}?": "Do you wish to {create_group} or {explore_groups}?", "Do you wish to {create_group} or {explore_groups}?": "Do you wish to {create_group} or {explore_groups}?",
"Type or select a date…": "Type or select a date…", "Type or select a date…": "Type or select a date…",
"Getting there": "Getting there", "Getting there": "Getting there",
"Groups are not enabled on this instance.": "Groups are not enabled on this instance." "Groups are not enabled on this instance.": "Groups are not enabled on this instance.",
"The events you created are not shown here.": "The events you created are not shown here."
} }

View file

@ -917,5 +917,6 @@
"Do you wish to {create_group} or {explore_groups}?": "Voulez-vous {create_group} ou {explore_groups} ?", "Do you wish to {create_group} or {explore_groups}?": "Voulez-vous {create_group} ou {explore_groups} ?",
"Type or select a date…": "Entrez ou sélectionnez une date…", "Type or select a date…": "Entrez ou sélectionnez une date…",
"Getting there": "S'y rendre", "Getting there": "S'y rendre",
"Groups are not enabled on this instance.": "Les groupes ne sont pas activés sur cette instance." "Groups are not enabled on this instance.": "Les groupes ne sont pas activés sur cette instance.",
"The events you created are not shown here.": "Les événements que vous avez créé ne s'affichent pas ici."
} }

View file

@ -259,9 +259,13 @@
<EventCard :event="event" /> <EventCard :event="event" />
</div> </div>
</div> </div>
<b-message v-else type="is-danger">{{ <b-message v-else type="is-danger"
$t("No events found") >{{ $t("No events found") }}<br />
}}</b-message> <b-icon size="is-small" icon="information-outline" />
<small v-if="goingToEvents.size > 0 || lastWeekEvents.length > 0">{{
$t("The events you created are not shown here.")
}}</small>
</b-message>
</section> </section>
</div> </div>
</div> </div>
@ -444,7 +448,7 @@ export default class Home extends Vue {
); );
} }
get goingToEvents(): Map<string, Map<string, IParticipant>> { get thisWeekGoingToEvents(): IParticipant[] {
const res = this.currentUserParticipations.filter( const res = this.currentUserParticipations.filter(
({ event, role }) => ({ event, role }) =>
event.beginsOn != null && event.beginsOn != null &&
@ -456,8 +460,11 @@ export default class Home extends Vue {
(a: IParticipant, b: IParticipant) => (a: IParticipant, b: IParticipant) =>
a.event.beginsOn.getTime() - b.event.beginsOn.getTime() a.event.beginsOn.getTime() - b.event.beginsOn.getTime()
); );
return res;
}
return res.reduce( get goingToEvents(): Map<string, Map<string, IParticipant>> {
return this.thisWeekGoingToEvents.reduce(
( (
acc: Map<string, Map<string, IParticipant>>, acc: Map<string, Map<string, IParticipant>>,
participation: IParticipant participation: IParticipant
@ -496,7 +503,7 @@ export default class Home extends Vue {
get filteredFeaturedEvents(): IEvent[] { get filteredFeaturedEvents(): IEvent[] {
return this.events.elements.filter( return this.events.elements.filter(
({ id }) => ({ id }) =>
!this.currentUserParticipations !this.thisWeekGoingToEvents
.filter( .filter(
(participation) => participation.role === ParticipantRole.CREATOR (participation) => participation.role === ParticipantRole.CREATOR
) )