diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 6ed7fc3347..623dfaec44 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -12,6 +12,9 @@ const NavPanel = { return !!timelineNames()[this.$route.name] }, timelinesRoute () { + if (this.$store.state.interface.lastTimeline) { + return this.$store.state.interface.lastTimeline + } return this.currentUser ? 'friends' : 'public-timeline' }, ...mapState({ diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index e13c66db3c..281052e523 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -50,6 +50,9 @@ const SideDrawer = { return this.$store.state.instance.federating }, timelinesRoute () { + if (this.$store.state.interface.lastTimeline) { + return this.$store.state.interface.lastTimeline + } return this.currentUser ? 'friends' : 'public-timeline' }, ...mapState({ diff --git a/src/components/timeline_menu/timeline_menu.js b/src/components/timeline_menu/timeline_menu.js index 02c1318d54..0afeb8b43e 100644 --- a/src/components/timeline_menu/timeline_menu.js +++ b/src/components/timeline_menu/timeline_menu.js @@ -26,6 +26,7 @@ const TimelineMenu = { if (this.currentUser && this.currentUser.locked) { this.$store.dispatch('startFetchingFollowRequests') } + this.$store.dispatch('setLastTimeline', this.$route.name) }, methods: { openMenu () { diff --git a/src/modules/interface.js b/src/modules/interface.js index ec08ac0a5a..748d30258f 100644 --- a/src/modules/interface.js +++ b/src/modules/interface.js @@ -16,7 +16,8 @@ const defaultState = { }, mobileLayout: false, globalNotices: [], - layoutHeight: 0 + layoutHeight: 0, + lastTimeline: null } const interfaceMod = { @@ -69,6 +70,9 @@ const interfaceMod = { }, setLayoutHeight (state, value) { state.layoutHeight = value + }, + setLastTimeline (state, value) { + state.lastTimeline = value } }, actions: { @@ -117,6 +121,9 @@ const interfaceMod = { }, setLayoutHeight ({ commit }, value) { commit('setLayoutHeight', value) + }, + setLastTimeline ({ commit }, value) { + commit('setLastTimeline', value) } } } diff --git a/src/modules/users.js b/src/modules/users.js index 16c1e566c4..9245db5c1e 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -499,6 +499,7 @@ const users = { store.commit('clearNotifications') store.commit('resetStatuses') store.dispatch('resetChats') + store.dispatch('setLastTimeline', 'public-timeline') }) }, loginUser (store, accessToken) {