aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_profile/user_profile.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-02-04 17:54:48 +0000
committerShpuld Shpludson <shp@cock.li>2019-02-04 17:54:48 +0000
commit8c8eb99d73aacd38781da2e6b151c9b76c1639a2 (patch)
tree7533728f9f115f877806694960dcaeb48d28dbd7 /src/components/user_profile/user_profile.js
parent3cd1deb133926281920f10c1ddd6eb694c09f44d (diff)
parent54e7e0e31babbfb0c4ebc2e1a73012e1b1890231 (diff)
Merge branch 'feat/follows-following-pagination' into 'develop'
Follows + followers pagination #285 See merge request pleroma/pleroma-fe!510
Diffstat (limited to 'src/components/user_profile/user_profile.js')
-rw-r--r--src/components/user_profile/user_profile.js65
1 files changed, 22 insertions, 43 deletions
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 27e138b0..7b0ab705 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -1,6 +1,7 @@
import UserCardContent from '../user_card_content/user_card_content.vue'
import UserCard from '../user_card/user_card.vue'
import Timeline from '../timeline/timeline.vue'
+import FollowList from '../follow_list/follow_list.vue'
const UserProfile = {
created () {
@@ -15,9 +16,7 @@ const UserProfile = {
}
},
destroyed () {
- this.$store.dispatch('stopFetching', 'user')
- this.$store.dispatch('stopFetching', 'favorites')
- this.$store.dispatch('stopFetching', 'media')
+ this.cleanUp(this.userId)
},
computed: {
timeline () {
@@ -39,12 +38,6 @@ const UserProfile = {
return this.userId && this.$store.state.users.currentUser.id &&
this.userId === this.$store.state.users.currentUser.id
},
- friends () {
- return this.user.friends
- },
- followers () {
- return this.user.followers
- },
userInStore () {
if (this.isExternal) {
return this.$store.getters.userById(this.userId)
@@ -68,61 +61,47 @@ const UserProfile = {
}
},
methods: {
- fetchFollowers () {
- const id = this.userId
- this.$store.dispatch('addFollowers', { id })
- },
- fetchFriends () {
- const id = this.userId
- this.$store.dispatch('addFriends', { id })
- },
startFetchFavorites () {
if (this.isUs) {
this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
}
- }
- },
- watch: {
- // TODO get rid of this copypasta
- userName () {
- if (this.isExternal) {
- return
- }
- this.$store.dispatch('stopFetching', 'user')
- this.$store.dispatch('stopFetching', 'favorites')
- this.$store.dispatch('stopFetching', 'media')
- this.$store.commit('clearTimeline', { timeline: 'user' })
- this.$store.commit('clearTimeline', { timeline: 'favorites' })
- this.$store.commit('clearTimeline', { timeline: 'media' })
+ },
+ startUp () {
this.$store.dispatch('startFetching', ['user', this.fetchBy])
this.$store.dispatch('startFetching', ['media', this.fetchBy])
+
this.startFetchFavorites()
},
- userId () {
- if (!this.isExternal) {
- return
- }
+ cleanUp () {
this.$store.dispatch('stopFetching', 'user')
this.$store.dispatch('stopFetching', 'favorites')
this.$store.dispatch('stopFetching', 'media')
this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.commit('clearTimeline', { timeline: 'media' })
- this.$store.dispatch('startFetching', ['user', this.fetchBy])
- this.$store.dispatch('startFetching', ['media', this.fetchBy])
- this.startFetchFavorites()
+ }
+ },
+ watch: {
+ userName () {
+ if (this.isExternal) {
+ return
+ }
+ this.cleanUp()
+ this.startUp()
},
- user () {
- if (this.user.id && !this.user.followers) {
- this.fetchFollowers()
- this.fetchFriends()
+ userId () {
+ if (!this.isExternal) {
+ return
}
+ this.cleanUp()
+ this.startUp()
}
},
components: {
UserCardContent,
UserCard,
- Timeline
+ Timeline,
+ FollowList
}
}