resume last lasttime instead of always friends/public

This commit is contained in:
Shpuld Shpuldson 2020-07-23 15:09:32 +03:00
parent 3598360ce5
commit fdbacba36a
5 changed files with 16 additions and 1 deletions

View File

@ -12,6 +12,9 @@ const NavPanel = {
return !!timelineNames()[this.$route.name] return !!timelineNames()[this.$route.name]
}, },
timelinesRoute () { timelinesRoute () {
if (this.$store.state.interface.lastTimeline) {
return this.$store.state.interface.lastTimeline
}
return this.currentUser ? 'friends' : 'public-timeline' return this.currentUser ? 'friends' : 'public-timeline'
}, },
...mapState({ ...mapState({

View File

@ -50,6 +50,9 @@ const SideDrawer = {
return this.$store.state.instance.federating return this.$store.state.instance.federating
}, },
timelinesRoute () { timelinesRoute () {
if (this.$store.state.interface.lastTimeline) {
return this.$store.state.interface.lastTimeline
}
return this.currentUser ? 'friends' : 'public-timeline' return this.currentUser ? 'friends' : 'public-timeline'
}, },
...mapState({ ...mapState({

View File

@ -26,6 +26,7 @@ const TimelineMenu = {
if (this.currentUser && this.currentUser.locked) { if (this.currentUser && this.currentUser.locked) {
this.$store.dispatch('startFetchingFollowRequests') this.$store.dispatch('startFetchingFollowRequests')
} }
this.$store.dispatch('setLastTimeline', this.$route.name)
}, },
methods: { methods: {
openMenu () { openMenu () {

View File

@ -16,7 +16,8 @@ const defaultState = {
}, },
mobileLayout: false, mobileLayout: false,
globalNotices: [], globalNotices: [],
layoutHeight: 0 layoutHeight: 0,
lastTimeline: null
} }
const interfaceMod = { const interfaceMod = {
@ -69,6 +70,9 @@ const interfaceMod = {
}, },
setLayoutHeight (state, value) { setLayoutHeight (state, value) {
state.layoutHeight = value state.layoutHeight = value
},
setLastTimeline (state, value) {
state.lastTimeline = value
} }
}, },
actions: { actions: {
@ -117,6 +121,9 @@ const interfaceMod = {
}, },
setLayoutHeight ({ commit }, value) { setLayoutHeight ({ commit }, value) {
commit('setLayoutHeight', value) commit('setLayoutHeight', value)
},
setLastTimeline ({ commit }, value) {
commit('setLastTimeline', value)
} }
} }
} }

View File

@ -499,6 +499,7 @@ const users = {
store.commit('clearNotifications') store.commit('clearNotifications')
store.commit('resetStatuses') store.commit('resetStatuses')
store.dispatch('resetChats') store.dispatch('resetChats')
store.dispatch('setLastTimeline', 'public-timeline')
}) })
}, },
loginUser (store, accessToken) { loginUser (store, accessToken) {