aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher/timeline_fetcher.service.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2018-12-03 09:29:33 +0300
committerHenry Jameson <me@hjkos.com>2018-12-03 09:29:33 +0300
commitccb1682379fda5b34506cb0a04df2ce38eaad6ad (patch)
tree354056482a9f518029d55c61dc1432ede3ae125b /src/services/timeline_fetcher/timeline_fetcher.service.js
parente15b9bddbb23e36632982296a7c9ec01fd2bb7c7 (diff)
Add userId property to timelines so that we don't overwrite user timeline meant
for another user
Diffstat (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 0e3e32d2..c2a7de56 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -2,13 +2,14 @@ import { camelCase } from 'lodash'
import apiService from '../api/api.service.js'
-const update = ({store, statuses, timeline, showImmediately}) => {
+const update = ({store, statuses, timeline, showImmediately, userId}) => {
const ccTimeline = camelCase(timeline)
store.dispatch('setError', { value: false })
store.dispatch('addNewStatuses', {
timeline: ccTimeline,
+ userId,
statuses,
showImmediately
})
@@ -33,7 +34,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
if (!older && statuses.length >= 20 && !timelineData.loading) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
- update({store, statuses, timeline, showImmediately})
+ update({store, statuses, timeline, showImmediately, userId})
}, () => store.dispatch('setError', { value: true }))
}
@@ -41,6 +42,7 @@ const startFetching = ({timeline = 'friends', credentials, store, userId = false
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
const showImmediately = timelineData.visibleStatuses.length === 0
+ timelineData.userId = userId
fetchAndUpdate({timeline, credentials, store, showImmediately, userId, tag})
const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId, tag })
return setInterval(boundFetchAndUpdate, 10000)