diff --git a/src/components/tag_timeline/tag_timeline.js b/src/components/tag_timeline/tag_timeline.js
new file mode 100644
index 00000000..43de4f49
--- /dev/null
+++ b/src/components/tag_timeline/tag_timeline.js
@@ -0,0 +1,26 @@
+import Timeline from '../timeline/timeline.vue'
+
+const TagTimeline = {
+ created () {
+ this.$store.commit('clearTimeline', { timeline: 'tag' })
+ this.$store.dispatch('startFetching', { 'tag': this.tag })
+ },
+ components: {
+ Timeline
+ },
+ computed: {
+ tag () { return this.$route.params.tag },
+ timeline () { return this.$store.state.statuses.timelines.tag }
+ },
+ watch: {
+ tag () {
+ this.$store.commit('clearTimeline', { timeline: 'tag' })
+ this.$store.dispatch('startFetching', { 'tag': this.tag })
+ }
+ },
+ destroyed () {
+ this.$store.dispatch('stopFetching', 'tag')
+ }
+}
+
+export default TagTimeline
diff --git a/src/components/tag_timeline/tag_timeline.js~ b/src/components/tag_timeline/tag_timeline.js~
new file mode 100644
index 00000000..084e69d3
--- /dev/null
+++ b/src/components/tag_timeline/tag_timeline.js~
@@ -0,0 +1,12 @@
+import Timeline from '../timeline/timeline.vue'
+
+const TagTimeline = {
+ components: {
+ Timeline
+ },
+ computed: {
+ timeline () { return this.$store.state.statuses.timelines.tag }
+ }
+};
+
+export default TagTimeline
diff --git a/src/components/tag_timeline/tag_timeline.vue b/src/components/tag_timeline/tag_timeline.vue
new file mode 100644
index 00000000..62bb579a
--- /dev/null
+++ b/src/components/tag_timeline/tag_timeline.vue
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tag_timeline/tag_timeline.vue~ b/src/components/tag_timeline/tag_timeline.vue~
new file mode 100644
index 00000000..158ae399
--- /dev/null
+++ b/src/components/tag_timeline/tag_timeline.vue~
@@ -0,0 +1,5 @@
+
+ timleinei
+
+
+
\ No newline at end of file
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index 06435745..bd80d57b 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -8,7 +8,8 @@ const Timeline = {
'timeline',
'timelineName',
'title',
- 'userId'
+ 'userId',
+ 'tag'
],
computed: {
timelineError () { return this.$store.state.statuses.error },
@@ -39,7 +40,8 @@ const Timeline = {
credentials,
timeline: this.timelineName,
showImmediately,
- userId: this.userId
+ userId: this.userId,
+ tag: this.tag
})
// don't fetch followers for public, friend, twkn
@@ -62,7 +64,8 @@ const Timeline = {
timeline: this.timelineName,
older: true,
showImmediately: true,
- userId: this.userId
+ userId: this.userId,
+ tag: this.tag
}).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false }))
},
fetchFollowers () {
diff --git a/src/main.js b/src/main.js
index e83e27c5..d1f99fa5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,6 +5,7 @@ import App from './App.vue'
import PublicTimeline from './components/public_timeline/public_timeline.vue'
import PublicAndExternalTimeline from './components/public_and_external_timeline/public_and_external_timeline.vue'
import FriendsTimeline from './components/friends_timeline/friends_timeline.vue'
+import TagTimeline from './components/tag_timeline/tag_timeline.vue'
import ConversationPage from './components/conversation-page/conversation-page.vue'
import Mentions from './components/mentions/mentions.vue'
import UserProfile from './components/user_profile/user_profile.vue'
@@ -58,6 +59,7 @@ const routes = [
{ path: '/main/all', component: PublicAndExternalTimeline },
{ path: '/main/public', component: PublicTimeline },
{ path: '/main/friends', component: FriendsTimeline },
+ { path: '/tag/:tag', component: TagTimeline },
{ name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
{ name: 'user-profile', path: '/users/:id', component: UserProfile },
{ name: 'mentions', path: '/:username/mentions', component: Mentions },
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 6c760eed..1cafa419 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -79,6 +79,20 @@ export const defaultState = {
followers: [],
friends: [],
viewing: 'statuses'
+ },
+ tag: {
+ statuses: [],
+ statusesObject: {},
+ faves: [],
+ visibleStatuses: [],
+ visibleStatusesObject: {},
+ newStatusCount: 0,
+ maxId: 0,
+ minVisibleId: 0,
+ loading: false,
+ followers: [],
+ friends: [],
+ viewing: 'statuses'
}
}
}
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 = {