diff --git a/backend/src/schema/types/type/User.gql b/backend/src/schema/types/type/User.gql index 1287aa45f..6bfb9b986 100644 --- a/backend/src/schema/types/type/User.gql +++ b/backend/src/schema/types/type/User.gql @@ -64,6 +64,7 @@ type User { comments: [Comment]! @relation(name: "WROTE", direction: "OUT") commentsCount: Int! @cypher(statement: "MATCH (this)-[:WROTE]->(r:Comment) WHERE NOT r.deleted = true AND NOT r.disabled = true RETURN COUNT(r)") + commentedCount: Int! @cypher(statement: "MATCH (this)-[:WROTE]->(r:Comment)-[:COMMENTS]->(p:Post) WHERE NOT r.deleted = true AND NOT r.disabled = true AND NOT p.deleted = true AND NOT p.disabled = true RETURN COUNT(DISTINCT(p))") shouted: [Post]! @relation(name: "SHOUTED", direction: "OUT") shoutedCount: Int! @cypher(statement: "MATCH (this)-[:SHOUTED]->(r:Post) WHERE NOT r.deleted = true AND NOT r.disabled = true RETURN COUNT(DISTINCT r)") diff --git a/webapp/graphql/UserProfile/User.js b/webapp/graphql/UserProfile/User.js index ad5a4b402..5bfe0510f 100644 --- a/webapp/graphql/UserProfile/User.js +++ b/webapp/graphql/UserProfile/User.js @@ -24,7 +24,7 @@ export default i18n => { } badgesCount shoutedCount - commentsCount + commentedCount followingCount following(first: 7) { id diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 84d507564..90071d322 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -154,7 +154,7 @@ - + @@ -273,10 +273,18 @@ export default { page: 1, pageSize: 6, tabActive: 'post', - filter + filter, } }, computed: { + hasMore() { + const total = { + post: this.user.contributionsCount, + shout: this.user.shoutedCount, + comment: this.user.commentedCount, + }[this.tabActive] + return this.Post && this.Post.length < total + }, myProfile() { return this.$route.params.id === this.$store.getters['auth/user'].id }, @@ -290,11 +298,6 @@ export default { offset() { return (this.page - 1) * this.pageSize }, - hasMore() { - return ( - this.Post && this.Post.length < this.user.contributionsCount - ) - }, activePosts() { if (!this.Post) { return []