diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2020-05-31 14:57:22 +0900 |
|---|---|---|
| committer | tamaina <tamaina@hotmail.co.jp> | 2020-05-31 14:57:22 +0900 |
| commit | 7c38cda8eecaf1dd54971400d8cfb568a9dc8023 (patch) | |
| tree | a3449b4b890ccfbc8dbe168a692acfac7c538511 /src/client/components | |
| parent | fix (diff) | |
| download | sharkey-7c38cda8eecaf1dd54971400d8cfb568a9dc8023.tar.gz sharkey-7c38cda8eecaf1dd54971400d8cfb568a9dc8023.tar.bz2 sharkey-7c38cda8eecaf1dd54971400d8cfb568a9dc8023.zip | |
Refactor
Diffstat (limited to 'src/client/components')
| -rw-r--r-- | src/client/components/notification.vue | 18 |
1 files changed, 10 insertions, 8 deletions
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)); } |