aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/timeline_fetcher')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 8e954cdf..9eb30c2d 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -2,7 +2,7 @@ import { camelCase } from 'lodash'
import apiService from '../api/api.service.js'
-const update = ({store, statuses, timeline, showImmediately, userId}) => {
+const update = ({ store, statuses, timeline, showImmediately, userId }) => {
const ccTimeline = camelCase(timeline)
store.dispatch('setError', { value: false })
@@ -15,13 +15,21 @@ const update = ({store, statuses, timeline, showImmediately, userId}) => {
})
}
-const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false, until}) => {
+const fetchAndUpdate = ({
+ store,
+ credentials,
+ timeline = 'friends',
+ older = false,
+ showImmediately = false,
+ userId = false,
+ tag = false,
+ until
+}) => {
const args = { timeline, credentials }
const rootState = store.rootState || store.state
+ const { getters } = store
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
- const hideMutedPosts = typeof rootState.config.hideMutedPosts === 'undefined'
- ? rootState.instance.hideMutedPosts
- : rootState.config.hideMutedPosts
+ const hideMutedPosts = getters.mergedConfig.hideMutedPosts
if (older) {
args['until'] = until || timelineData.minId
@@ -40,17 +48,17 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
- update({store, statuses, timeline, showImmediately, userId})
+ update({ store, statuses, timeline, showImmediately, userId })
return statuses
}, () => store.dispatch('setError', { value: true }))
}
-const startFetching = ({timeline = 'friends', credentials, store, userId = false, tag = false}) => {
+const startFetching = ({ timeline = 'friends', credentials, store, userId = false, tag = 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})
+ fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, tag })
const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId, tag })
return setInterval(boundFetchAndUpdate, 10000)
}