From 160e5fbdae4e072e915e7bfc208b6ae350a01320 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 11 Jun 2021 15:08:43 +0200 Subject: [PATCH] Fix discussions pagination Signed-off-by: Thomas Citharel --- js/src/components/Comment/CommentTree.vue | 6 +-- .../Discussion/DiscussionComment.vue | 7 +++- js/src/mixins/group.ts | 4 +- js/src/views/Discussions/Discussion.vue | 40 +++++++++++++------ 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/js/src/components/Comment/CommentTree.vue b/js/src/components/Comment/CommentTree.vue index 70a08c0b..816e4073 100644 --- a/js/src/components/Comment/CommentTree.vue +++ b/js/src/components/Comment/CommentTree.vue @@ -107,11 +107,7 @@ import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core"; eventUUID: this.event.uuid, }; }, - update(data) { - return data.event.comments.map( - (comment: IComment) => new CommentModel(comment) - ); - }, + update: (data) => data.event.comments, skip() { return !this.event.uuid; }, diff --git a/js/src/components/Discussion/DiscussionComment.vue b/js/src/components/Discussion/DiscussionComment.vue index 2cb6bc3b..f4b99040 100644 --- a/js/src/components/Discussion/DiscussionComment.vue +++ b/js/src/components/Discussion/DiscussionComment.vue @@ -57,7 +57,12 @@

{{ diff --git a/js/src/mixins/group.ts b/js/src/mixins/group.ts index 26be0c3e..c6e9f602 100644 --- a/js/src/mixins/group.ts +++ b/js/src/mixins/group.ts @@ -15,6 +15,8 @@ import { import { MemberRole } from "@/types/enums"; import { Component, Vue } from "vue-property-decorator"; +const now = new Date(); + @Component({ apollo: { group: { @@ -24,7 +26,7 @@ import { Component, Vue } from "vue-property-decorator"; return { name: this.$route.params.preferredUsername, beforeDateTime: null, - afterDateTime: new Date(), + afterDateTime: now, }; }, skip() { diff --git a/js/src/views/Discussions/Discussion.vue b/js/src/views/Discussions/Discussion.vue index 12b50656..aa4999b6 100644 --- a/js/src/views/Discussions/Discussion.vue +++ b/js/src/views/Discussions/Discussion.vue @@ -127,7 +127,6 @@