mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #2012 from Human-Connection/2011-fix-bug-load-more-profile-page
Update fetchMore functionality on profile page
This commit is contained in:
commit
20121d268d
@ -376,7 +376,7 @@ export default {
|
||||
return uniqBy(items, field)
|
||||
},
|
||||
showMoreContributions() {
|
||||
const { Post: PostQuery } = this.$apollo.queries
|
||||
const { profilePagePosts: PostQuery } = this.$apollo.queries
|
||||
if (!PostQuery) return // seems this can be undefined on subpages
|
||||
this.offset += this.pageSize
|
||||
|
||||
@ -388,11 +388,14 @@ export default {
|
||||
orderBy: 'createdAt_desc',
|
||||
},
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
if (!fetchMoreResult || fetchMoreResult.Post.length < this.pageSize) {
|
||||
if (!fetchMoreResult || fetchMoreResult.profilePagePosts.length < this.pageSize) {
|
||||
this.hasMore = false
|
||||
}
|
||||
const result = Object.assign({}, previousResult, {
|
||||
Post: [...previousResult.Post, ...fetchMoreResult.Post],
|
||||
profilePagePosts: [
|
||||
...previousResult.profilePagePosts,
|
||||
...fetchMoreResult.profilePagePosts,
|
||||
],
|
||||
})
|
||||
return result
|
||||
},
|
||||
@ -407,13 +410,13 @@ export default {
|
||||
await this.$apollo.mutate({ mutation: Block(), variables: { id: user.id } })
|
||||
this.$apollo.queries.User.refetch()
|
||||
this.resetPostList()
|
||||
this.$apollo.queries.Post.refetch()
|
||||
this.$apollo.queries.profilePagePosts.refetch()
|
||||
},
|
||||
async unblock(user) {
|
||||
await this.$apollo.mutate({ mutation: Unblock(), variables: { id: user.id } })
|
||||
this.$apollo.queries.User.refetch()
|
||||
this.resetPostList()
|
||||
this.$apollo.queries.Post.refetch()
|
||||
this.$apollo.queries.profilePagePosts.refetch()
|
||||
},
|
||||
pinPost(post) {
|
||||
this.$apollo
|
||||
@ -424,7 +427,7 @@ export default {
|
||||
.then(() => {
|
||||
this.$toast.success(this.$t('post.menu.pinnedSuccessfully'))
|
||||
this.resetPostList()
|
||||
this.$apollo.queries.Post.refetch()
|
||||
this.$apollo.queries.profilePagePosts.refetch()
|
||||
})
|
||||
.catch(error => this.$toast.error(error.message))
|
||||
},
|
||||
@ -437,7 +440,7 @@ export default {
|
||||
.then(() => {
|
||||
this.$toast.success(this.$t('post.menu.unpinnedSuccessfully'))
|
||||
this.resetPostList()
|
||||
this.$apollo.queries.Post.refetch()
|
||||
this.$apollo.queries.profilePagePosts.refetch()
|
||||
})
|
||||
.catch(error => this.$toast.error(error.message))
|
||||
},
|
||||
@ -464,7 +467,7 @@ export default {
|
||||
},
|
||||
},
|
||||
apollo: {
|
||||
Post: {
|
||||
profilePagePosts: {
|
||||
query() {
|
||||
return profilePagePosts(this.$i18n)
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user