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 6ed7fc33..623dfaec 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 e13c66db..281052e5 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 02c1318d..0afeb8b4 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 ec08ac0a..748d3025 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 16c1e566..9245db5c 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) {