From fdbacba36a99b1f2ef200b8194a1964d9b87f9e1 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 23 Jul 2020 15:09:32 +0300 Subject: [PATCH] resume last lasttime instead of always friends/public --- src/components/nav_panel/nav_panel.js | 3 +++ src/components/side_drawer/side_drawer.js | 3 +++ src/components/timeline_menu/timeline_menu.js | 1 + src/modules/interface.js | 9 ++++++++- src/modules/users.js | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) 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) {