diff options
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/api/api.service.js | 10 | ||||
| -rw-r--r-- | src/services/timeline_fetcher/timeline_fetcher.service.js | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index aad3b40e..28f8936b 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -4,6 +4,7 @@ const FRIENDS_TIMELINE_URL = '/api/statuses/friends_timeline.json' const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing' const PUBLIC_TIMELINE_URL = '/api/statuses/public_timeline.json' const PUBLIC_AND_EXTERNAL_TIMELINE_URL = '/api/statuses/public_and_external_timeline.json' +const TAG_TIMELINE_URL = '/api/statusnet/tags/timeline' const FAVORITE_URL = '/api/favorites/create' const UNFAVORITE_URL = '/api/favorites/destroy' const RETWEET_URL = '/api/statuses/retweet' @@ -228,13 +229,14 @@ const setUserMute = ({id, credentials, muted = true}) => { }) } -const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false}) => { +const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false}) => { const timelineUrls = { public: PUBLIC_TIMELINE_URL, friends: FRIENDS_TIMELINE_URL, mentions: MENTIONS_URL, 'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL, - user: QVITTER_USER_TIMELINE_URL + user: QVITTER_USER_TIMELINE_URL, + tag: TAG_TIMELINE_URL } let url = timelineUrls[timeline] @@ -247,10 +249,12 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use if (until) { params.push(['max_id', until]) } - if (userId) { params.push(['user_id', userId]) } + if (tag) { + url += `/${tag}.json` + } const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') url += `?${queryString}` diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index b28de9e7..6b76eb54 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -14,7 +14,7 @@ const update = ({store, statuses, timeline, showImmediately}) => { }) } -const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false}) => { +const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false}) => { const args = { timeline, credentials } const rootState = store.rootState || store.state const timelineData = rootState.statuses.timelines[camelCase(timeline)] @@ -26,15 +26,16 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false } args['userId'] = userId + args['tag'] = tag return apiService.fetchTimeline(args) .then((statuses) => update({store, statuses, timeline, showImmediately}), () => store.dispatch('setError', { value: true })) } -const startFetching = ({timeline = 'friends', credentials, store, userId = false}) => { - fetchAndUpdate({timeline, credentials, store, showImmediately: true, userId}) - const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId }) +const startFetching = ({timeline = 'friends', credentials, store, userId = false, tag = false}) => { + fetchAndUpdate({timeline, credentials, store, showImmediately: true, userId, tag}) + const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId, tag }) return setInterval(boundFetchAndUpdate, 10000) } const timelineFetcher = { |
