aboutsummaryrefslogtreecommitdiff
path: root/src/components/timeline/timeline.js
diff options
context:
space:
mode:
authorShpuld Shpuldson <shpuld@gmail.com>2017-08-23 12:40:39 -0400
committerShpuld Shpuldson <shpuld@gmail.com>2017-08-23 12:40:39 -0400
commit2bc261afbaf9377450999e49a5fe46dcbcc8b180 (patch)
tree92d346b6bba58b7a3aef6155c9f3073028a07cf0 /src/components/timeline/timeline.js
parent5a1ad8409244ca7deb224b172ceb2b4acf7b8614 (diff)
parente1ec01dc3ef90c0dc033d2e648da9a2acf8a1bdd (diff)
Merge branch 'feature/follow-lists' into 'develop'
Feature/follow lists See merge request !106
Diffstat (limited to 'src/components/timeline/timeline.js')
-rw-r--r--src/components/timeline/timeline.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index 3dc07f9e..06435745 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -1,6 +1,7 @@
import Status from '../status/status.vue'
import timelineFetcher from '../../services/timeline_fetcher/timeline_fetcher.service.js'
import StatusOrConversation from '../status_or_conversation/status_or_conversation.vue'
+import UserCard from '../user_card/user_card.vue'
const Timeline = {
props: [
@@ -10,11 +11,21 @@ const Timeline = {
'userId'
],
computed: {
- timelineError () { return this.$store.state.statuses.error }
+ timelineError () { return this.$store.state.statuses.error },
+ followers () {
+ return this.timeline.followers
+ },
+ friends () {
+ return this.timeline.friends
+ },
+ viewing () {
+ return this.timeline.viewing
+ }
},
components: {
Status,
- StatusOrConversation
+ StatusOrConversation,
+ UserCard
},
created () {
const store = this.$store
@@ -30,6 +41,12 @@ const Timeline = {
showImmediately,
userId: this.userId
})
+
+ // don't fetch followers for public, friend, twkn
+ if (this.timelineName === 'user') {
+ this.fetchFriends()
+ this.fetchFollowers()
+ }
},
methods: {
showNewStatuses () {
@@ -48,6 +65,16 @@ const Timeline = {
userId: this.userId
}).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false }))
},
+ fetchFollowers () {
+ const id = this.userId
+ this.$store.state.api.backendInteractor.fetchFollowers({ id })
+ .then((followers) => this.$store.dispatch('addFollowers', { followers }))
+ },
+ fetchFriends () {
+ const id = this.userId
+ this.$store.state.api.backendInteractor.fetchFriends({ id })
+ .then((friends) => this.$store.dispatch('addFriends', { friends }))
+ },
scrollLoad (e) {
let height = Math.max(document.body.offsetHeight, document.body.scrollHeight)
if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (height - 750)) {