From 7c38cda8eecaf1dd54971400d8cfb568a9dc8023 Mon Sep 17 00:00:00 2001
From: tamaina <tamaina@hotmail.co.jp>
Date: Sun, 31 May 2020 14:57:22 +0900
Subject: Refactor

---
 src/client/components/notification.vue | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'src/client/components/notification.vue')

diff --git a/src/client/components/notification.vue b/src/client/components/notification.vue
index 4fde7d3748..6c423fdecd 100644
--- a/src/client/components/notification.vue
+++ b/src/client/components/notification.vue
@@ -91,21 +91,23 @@ export default Vue.extend({
 			followRequestDone: false,
 			groupInviteDone: false,
 			connection: null,
-			readObserver: new IntersectionObserver((entries, observer) => {
+			readObserver: null,
+			faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck, faPollH
+		};
+	},
+
+	mounted() {
+		if (!this.notification.isRead ) {
+			this.readObserver = new IntersectionObserver((entries, observer) => {
 				if (!entries.some(entry => entry.isIntersecting)) return;
 				this.$root.stream.send('readNotification', {
 					id: this.notification.id
 				});
 				entries.map(({ target }) => observer.unobserve(target));
-			}),
-			faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck, faPollH
-		};
-	},
+			})
 
-	mounted() {
-		if (!this.notification.isRead) {
 			this.readObserver.observe(this.$el);
-			
+
 			this.connection = this.$root.stream.useSharedConnection('main');
 			this.connection.on('readAllNotifications', () => this.readObserver.unobserve(this.$el));
 		}
-- 
cgit v1.2.3-freya

