From 70a2f6003143fe924695f81ad2a0a485ddc31326 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Mon, 26 Mar 2018 21:58:58 +0900 Subject: [PATCH] refs #138 Hide unread mark when user already opened the timeline --- src/renderer/components/TimelineSpace/Home.vue | 11 ++++++++--- .../components/TimelineSpace/Notifications.vue | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Home.vue b/src/renderer/components/TimelineSpace/Home.vue index d311a74c..b339a9be 100644 --- a/src/renderer/components/TimelineSpace/Home.vue +++ b/src/renderer/components/TimelineSpace/Home.vue @@ -13,13 +13,18 @@ import Toot from './Cards/Toot' export default { name: 'home', components: { Toot }, - mounted () { - this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false) - }, computed: { ...mapState({ timeline: state => state.TimelineSpace.homeTimeline }) + }, + mounted () { + this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false) + }, + beforeUpdate () { + if (this.$store.state.TimelineSpace.SideMenu.unreadHomeTimeline) { + this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false) + } } } diff --git a/src/renderer/components/TimelineSpace/Notifications.vue b/src/renderer/components/TimelineSpace/Notifications.vue index bce72445..f9e2156a 100644 --- a/src/renderer/components/TimelineSpace/Notifications.vue +++ b/src/renderer/components/TimelineSpace/Notifications.vue @@ -13,13 +13,18 @@ import Notification from './Cards/Notification' export default { name: 'notifications', components: { Notification }, - mounted () { - this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false) - }, computed: { ...mapState({ notifications: state => state.TimelineSpace.notifications }) + }, + mounted () { + this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false) + }, + beforeUpdate () { + if (this.$store.state.TimelineSpace.SideMenu.unreadNotifications) { + this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false) + } } }