Commit b82ba54a authored by Shpuld Shpludson's avatar Shpuld Shpludson

Merge branch 'feature/media-timeline' into 'develop'

media timeline

See merge request pleroma/pleroma-fe!472
parents 8197c77f efad3ad0
...@@ -6,8 +6,10 @@ const UserProfile = { ...@@ -6,8 +6,10 @@ const UserProfile = {
created () { created () {
this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.commit('clearTimeline', { timeline: 'media' })
this.$store.dispatch('startFetching', ['user', this.fetchBy]) this.$store.dispatch('startFetching', ['user', this.fetchBy])
this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
this.$store.dispatch('startFetching', ['media', this.fetchBy])
if (!this.user.id) { if (!this.user.id) {
this.$store.dispatch('fetchUser', this.fetchBy) this.$store.dispatch('fetchUser', this.fetchBy)
} }
...@@ -15,6 +17,7 @@ const UserProfile = { ...@@ -15,6 +17,7 @@ const UserProfile = {
destroyed () { destroyed () {
this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'user')
this.$store.dispatch('stopFetching', 'favorites') this.$store.dispatch('stopFetching', 'favorites')
this.$store.dispatch('stopFetching', 'media')
}, },
computed: { computed: {
timeline () { timeline () {
...@@ -23,6 +26,9 @@ const UserProfile = { ...@@ -23,6 +26,9 @@ const UserProfile = {
favorites () { favorites () {
return this.$store.state.statuses.timelines.favorites return this.$store.state.statuses.timelines.favorites
}, },
media () {
return this.$store.state.statuses.timelines.media
},
userId () { userId () {
return this.$route.params.id || this.user.id return this.$route.params.id || this.user.id
}, },
...@@ -78,10 +84,13 @@ const UserProfile = { ...@@ -78,10 +84,13 @@ const UserProfile = {
} }
this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'user')
this.$store.dispatch('stopFetching', 'favorites') this.$store.dispatch('stopFetching', 'favorites')
this.$store.dispatch('stopFetching', 'media')
this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.commit('clearTimeline', { timeline: 'media' })
this.$store.dispatch('startFetching', ['user', this.fetchBy]) this.$store.dispatch('startFetching', ['user', this.fetchBy])
this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
this.$store.dispatch('startFetching', ['media', this.fetchBy])
}, },
userId () { userId () {
if (!this.isExternal) { if (!this.isExternal) {
...@@ -89,10 +98,13 @@ const UserProfile = { ...@@ -89,10 +98,13 @@ const UserProfile = {
} }
this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'user')
this.$store.dispatch('stopFetching', 'favorites') this.$store.dispatch('stopFetching', 'favorites')
this.$store.dispatch('stopFetching', 'media')
this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.commit('clearTimeline', { timeline: 'media' })
this.$store.dispatch('startFetching', ['user', this.fetchBy]) this.$store.dispatch('startFetching', ['user', this.fetchBy])
this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
this.$store.dispatch('startFetching', ['media', this.fetchBy])
}, },
user () { user () {
if (this.user.id && !this.user.followers) { if (this.user.id && !this.user.followers) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<i class="icon-spin3 animate-spin"></i> <i class="icon-spin3 animate-spin"></i>
</div> </div>
</div> </div>
<Timeline :label="$t('user_card.media')" :embedded="true" :title="$t('user_profile.media_title')" timeline-name="media" :timeline="media" :user-id="fetchBy" />
<Timeline v-if="isUs" :label="$t('user_card.favorites')" :embedded="true" :title="$t('user_profile.favorites_title')" timeline-name="favorites" :timeline="favorites"/> <Timeline v-if="isUs" :label="$t('user_card.favorites')" :embedded="true" :title="$t('user_profile.favorites_title')" timeline-name="favorites" :timeline="favorites"/>
</tab-switcher> </tab-switcher>
</div> </div>
......
...@@ -335,6 +335,7 @@ ...@@ -335,6 +335,7 @@
"following": "Following!", "following": "Following!",
"follows_you": "Follows you!", "follows_you": "Follows you!",
"its_you": "It's you!", "its_you": "It's you!",
"media": "Media",
"mute": "Mute", "mute": "Mute",
"muted": "Muted", "muted": "Muted",
"per_day": "per day", "per_day": "per day",
......
...@@ -37,6 +37,7 @@ export const defaultState = { ...@@ -37,6 +37,7 @@ export const defaultState = {
public: emptyTl(), public: emptyTl(),
user: emptyTl(), user: emptyTl(),
favorites: emptyTl(), favorites: emptyTl(),
media: emptyTl(),
publicAndExternal: emptyTl(), publicAndExternal: emptyTl(),
friends: emptyTl(), friends: emptyTl(),
tag: emptyTl(), tag: emptyTl(),
......
...@@ -325,6 +325,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use ...@@ -325,6 +325,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
notifications: QVITTER_USER_NOTIFICATIONS_URL, notifications: QVITTER_USER_NOTIFICATIONS_URL,
'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL, 'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL,
user: QVITTER_USER_TIMELINE_URL, user: QVITTER_USER_TIMELINE_URL,
media: QVITTER_USER_TIMELINE_URL,
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL, favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
tag: TAG_TIMELINE_URL tag: TAG_TIMELINE_URL
} }
...@@ -345,6 +346,9 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use ...@@ -345,6 +346,9 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
if (tag) { if (tag) {
url += `/${tag}.json` url += `/${tag}.json`
} }
if (timeline === 'media') {
params.push(['only_media', 1])
}
params.push(['count', 20]) params.push(['count', 20])
......
...@@ -66,6 +66,22 @@ const externalProfileStore = new Vuex.Store({ ...@@ -66,6 +66,22 @@ const externalProfileStore = new Vuex.Store({
viewing: 'statuses', viewing: 'statuses',
userId: 100, userId: 100,
flushMarker: 0 flushMarker: 0
},
media: {
statuses: [],
statusesObject: {},
faves: [],
visibleStatuses: [],
visibleStatusesObject: {},
newStatusCount: 0,
maxId: 0,
minVisibleId: 0,
loading: false,
followers: [],
friends: [],
viewing: 'statuses',
userId: 100,
flushMarker: 0
} }
} }
}, },
...@@ -116,6 +132,22 @@ const localProfileStore = new Vuex.Store({ ...@@ -116,6 +132,22 @@ const localProfileStore = new Vuex.Store({
viewing: 'statuses', viewing: 'statuses',
userId: 100, userId: 100,
flushMarker: 0 flushMarker: 0
},
media: {
statuses: [],
statusesObject: {},
faves: [],
visibleStatuses: [],
visibleStatusesObject: {},
newStatusCount: 0,
maxId: 0,
minVisibleId: 0,
loading: false,
followers: [],
friends: [],
viewing: 'statuses',
userId: 100,
flushMarker: 0
} }
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment