+
-
+
-
+
-
+
+
- {{ user.about }}
+ {{ group.about }}
@@ -90,7 +91,7 @@
{{ $t('profile.network.title') }}
-
-
+ /> -->
+
-
+
+
-
+
@@ -184,19 +185,20 @@ import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
import TabNavigation from '~/components/_new/generic/TabNavigation/TabNavigation'
import { profilePagePosts } from '~/graphql/PostQuery'
-import UserQuery from '~/graphql/User'
+import { groupQuery } from '~/graphql/groups'
import { muteUser, unmuteUser } from '~/graphql/settings/MutedUsers'
import { blockUser, unblockUser } from '~/graphql/settings/BlockedUsers'
import UpdateQuery from '~/components/utils/UpdateQuery'
import SocialMedia from '~/components/SocialMedia/SocialMedia'
-const tabToFilterMapping = ({ tab, id }) => {
- return {
- post: { author: { id } },
- comment: { comments_some: { author: { id } } },
- shout: { shoutedBy_some: { id } },
- }[tab]
-}
+// Wolle:
+// const tabToFilterMapping = ({ tab, id }) => {
+// return {
+// post: { author: { id } },
+// comment: { comments_some: { author: { id } } },
+// shout: { shoutedBy_some: { id } },
+// }[tab]
+// }
export default {
components: {
@@ -220,194 +222,201 @@ export default {
mode: 'out-in',
},
data() {
- const filter = tabToFilterMapping({ tab: 'post', id: this.$route.params.id })
+ // Wolle:
+ // const filter = tabToFilterMapping({ tab: 'post', id: this.$route.params.id })
return {
- User: [],
+ Group: [],
posts: [],
hasMore: true,
offset: 0,
pageSize: 6,
tabActive: 'post',
- filter,
+ // Wolle: filter,
followedByCountStartValue: 0,
followedByCount: 7,
followingCount: 7,
}
},
computed: {
- myProfile() {
- return this.$route.params.id === this.$store.getters['auth/user'].id
+ isMyGroup() {
+ return this.group.myRole
},
- user() {
- return this.User ? this.User[0] : {}
+ group() {
+ return this.Group ? this.Group[0] : {}
},
- userName() {
- const { name } = this.user || {}
+ groupName() {
+ const { name } = this.group || {}
return name || this.$t('profile.userAnonym')
},
- userSlug() {
- const { slug } = this.user || {}
+ groupSlug() {
+ const { slug } = this.group || {}
return slug && `@${slug}`
},
- tabOptions() {
- return [
- {
- type: 'post',
- title: this.$t('common.post', null, this.user.contributionsCount),
- count: this.user.contributionsCount,
- disabled: this.user.contributionsCount === 0,
- },
- {
- type: 'comment',
- title: this.$t('profile.commented'),
- count: this.user.commentedCount,
- disabled: this.user.commentedCount === 0,
- },
- {
- type: 'shout',
- title: this.$t('profile.shouted'),
- count: this.user.shoutedCount,
- disabled: this.user.shoutedCount === 0,
- },
- ]
- },
+ // tabOptions() {
+ // return [
+ // {
+ // type: 'post',
+ // title: this.$t('common.post', null, this.user.contributionsCount),
+ // count: this.user.contributionsCount,
+ // disabled: this.user.contributionsCount === 0,
+ // },
+ // {
+ // type: 'comment',
+ // title: this.$t('profile.commented'),
+ // count: this.user.commentedCount,
+ // disabled: this.user.commentedCount === 0,
+ // },
+ // {
+ // type: 'shout',
+ // title: this.$t('profile.shouted'),
+ // count: this.user.shoutedCount,
+ // disabled: this.user.shoutedCount === 0,
+ // },
+ // ]
+ // },
},
methods: {
- handleTab(tab) {
- if (this.tabActive !== tab) {
- this.tabActive = tab
- this.filter = tabToFilterMapping({ tab, id: this.$route.params.id })
- this.resetPostList()
- }
- },
+ // Wolle: handleTab(tab) {
+ // if (this.tabActive !== tab) {
+ // this.tabActive = tab
+ // this.filter = tabToFilterMapping({ tab, id: this.$route.params.id })
+ // this.resetPostList()
+ // }
+ // },
uniq(items, field = 'id') {
return uniqBy(items, field)
},
- showMoreContributions($state) {
- const { profilePagePosts: PostQuery } = this.$apollo.queries
- if (!PostQuery) return // seems this can be undefined on subpages
- this.offset += this.pageSize
+ // Wolle:
+ // showMoreContributions($state) {
+ // const { profilePagePosts: PostQuery } = this.$apollo.queries
+ // if (!PostQuery) return // seems this can be undefined on subpages
+ // this.offset += this.pageSize
- PostQuery.fetchMore({
- variables: {
- offset: this.offset,
- filter: this.filter,
- first: this.pageSize,
- orderBy: 'createdAt_desc',
- },
- updateQuery: UpdateQuery(this, { $state, pageKey: 'profilePagePosts' }),
- })
- },
- resetPostList() {
- this.offset = 0
- this.posts = []
- this.hasMore = true
- },
- refetchPostList() {
- this.resetPostList()
- this.$apollo.queries.profilePagePosts.refetch()
- },
- async muteUser(user) {
- try {
- await this.$apollo.mutate({ mutation: muteUser(), variables: { id: user.id } })
- } catch (error) {
- this.$toast.error(error.message)
- } finally {
- this.$apollo.queries.User.refetch()
- this.resetPostList()
- this.$apollo.queries.profilePagePosts.refetch()
- }
- },
- async unmuteUser(user) {
- try {
- this.$apollo.mutate({ mutation: unmuteUser(), variables: { id: user.id } })
- } catch (error) {
- this.$toast.error(error.message)
- } finally {
- this.$apollo.queries.User.refetch()
- this.resetPostList()
- this.$apollo.queries.profilePagePosts.refetch()
- }
- },
- async blockUser(user) {
- try {
- await this.$apollo.mutate({ mutation: blockUser(), variables: { id: user.id } })
- } catch (error) {
- this.$toast.error(error.message)
- } finally {
- this.$apollo.queries.User.refetch()
- }
- },
- async unblockUser(user) {
- try {
- this.$apollo.mutate({ mutation: unblockUser(), variables: { id: user.id } })
- } catch (error) {
- this.$toast.error(error.message)
- } finally {
- this.$apollo.queries.User.refetch()
- }
- },
- async deleteUser(userdata) {
- this.$store.commit('modal/SET_OPEN', {
- name: 'delete',
- data: {
- userdata: userdata,
- },
- })
- },
- optimisticFollow({ followedByCurrentUser }) {
- /*
- * Note: followedByCountStartValue is updated to avoid counting from 0 when follow/unfollow
- */
- this.followedByCountStartValue = this.user.followedByCount
- const currentUser = this.$store.getters['auth/user']
- if (followedByCurrentUser) {
- this.user.followedByCount++
- this.user.followedBy = [currentUser, ...this.user.followedBy]
- } else {
- this.user.followedByCount--
- this.user.followedBy = this.user.followedBy.filter((user) => user.id !== currentUser.id)
- }
- this.user.followedByCurrentUser = followedByCurrentUser
- },
- updateFollow({ followedByCurrentUser, followedBy, followedByCount }) {
- this.followedByCountStartValue = this.user.followedByCount
- this.user.followedByCount = followedByCount
- this.user.followedByCurrentUser = followedByCurrentUser
- this.user.followedBy = followedBy
- },
- fetchAllConnections(type) {
- if (type === 'following') this.followingCount = Infinity
- if (type === 'followedBy') this.followedByCount = Infinity
- },
+ // PostQuery.fetchMore({
+ // variables: {
+ // offset: this.offset,
+ // filter: this.filter,
+ // first: this.pageSize,
+ // orderBy: 'createdAt_desc',
+ // },
+ // updateQuery: UpdateQuery(this, { $state, pageKey: 'profilePagePosts' }),
+ // })
+ // },
+ // resetPostList() {
+ // this.offset = 0
+ // this.posts = []
+ // this.hasMore = true
+ // },
+ // refetchPostList() {
+ // this.resetPostList()
+ // this.$apollo.queries.profilePagePosts.refetch()
+ // },
+ // async muteUser(user) {
+ // try {
+ // await this.$apollo.mutate({ mutation: muteUser(), variables: { id: user.id } })
+ // } catch (error) {
+ // this.$toast.error(error.message)
+ // } finally {
+ // this.$apollo.queries.User.refetch()
+ // this.resetPostList()
+ // this.$apollo.queries.profilePagePosts.refetch()
+ // }
+ // },
+ // async unmuteUser(user) {
+ // try {
+ // this.$apollo.mutate({ mutation: unmuteUser(), variables: { id: user.id } })
+ // } catch (error) {
+ // this.$toast.error(error.message)
+ // } finally {
+ // this.$apollo.queries.User.refetch()
+ // this.resetPostList()
+ // this.$apollo.queries.profilePagePosts.refetch()
+ // }
+ // },
+ // async blockUser(user) {
+ // try {
+ // await this.$apollo.mutate({ mutation: blockUser(), variables: { id: user.id } })
+ // } catch (error) {
+ // this.$toast.error(error.message)
+ // } finally {
+ // this.$apollo.queries.User.refetch()
+ // }
+ // },
+ // async unblockUser(user) {
+ // try {
+ // this.$apollo.mutate({ mutation: unblockUser(), variables: { id: user.id } })
+ // } catch (error) {
+ // this.$toast.error(error.message)
+ // } finally {
+ // this.$apollo.queries.User.refetch()
+ // }
+ // },
+ // async deleteUser(userdata) {
+ // this.$store.commit('modal/SET_OPEN', {
+ // name: 'delete',
+ // data: {
+ // userdata: userdata,
+ // },
+ // })
+ // },
+ // Wolle:
+ // optimisticFollow({ followedByCurrentUser }) {
+ // /*
+ // * Note: followedByCountStartValue is updated to avoid counting from 0 when follow/unfollow
+ // */
+ // this.followedByCountStartValue = this.user.followedByCount
+ // const currentUser = this.$store.getters['auth/user']
+ // if (followedByCurrentUser) {
+ // this.user.followedByCount++
+ // this.user.followedBy = [currentUser, ...this.user.followedBy]
+ // } else {
+ // this.user.followedByCount--
+ // this.user.followedBy = this.user.followedBy.filter((user) => user.id !== currentUser.id)
+ // }
+ // this.user.followedByCurrentUser = followedByCurrentUser
+ // },
+ // Wolle:
+ // updateFollow({ followedByCurrentUser, followedBy, followedByCount }) {
+ // this.followedByCountStartValue = this.user.followedByCount
+ // this.user.followedByCount = followedByCount
+ // this.user.followedByCurrentUser = followedByCurrentUser
+ // this.user.followedBy = followedBy
+ // },
+ // Wolle:
+ // fetchAllConnections(type) {
+ // if (type === 'following') this.followingCount = Infinity
+ // if (type === 'followedBy') this.followedByCount = Infinity
+ // },
},
apollo: {
- profilePagePosts: {
+ // Wolle:
+ // profilePagePosts: {
+ // query() {
+ // return profilePagePosts(this.$i18n)
+ // },
+ // variables() {
+ // return {
+ // filter: this.filter,
+ // first: this.pageSize,
+ // offset: 0,
+ // orderBy: 'createdAt_desc',
+ // }
+ // },
+ // update({ profilePagePosts }) {
+ // this.posts = profilePagePosts
+ // },
+ // fetchPolicy: 'cache-and-network',
+ // },
+ Group: {
query() {
- return profilePagePosts(this.$i18n)
- },
- variables() {
- return {
- filter: this.filter,
- first: this.pageSize,
- offset: 0,
- orderBy: 'createdAt_desc',
- }
- },
- update({ profilePagePosts }) {
- this.posts = profilePagePosts
- },
- fetchPolicy: 'cache-and-network',
- },
- User: {
- query() {
- return UserQuery(this.$i18n)
+ // Wolle: return groupQuery(this.$i18n) // language will be needed for lacations
+ return groupQuery
},
variables() {
return {
id: this.$route.params.id,
- followedByCount: this.followedByCount,
- followingCount: this.followingCount,
+ // followedByCount: this.followedByCount,
+ // followingCount: this.followingCount,
}
},
fetchPolicy: 'cache-and-network',