summaryrefslogtreecommitdiff
path: root/src/client/components
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2020-05-31 14:57:22 +0900
committertamaina <tamaina@hotmail.co.jp>2020-05-31 14:57:22 +0900
commit7c38cda8eecaf1dd54971400d8cfb568a9dc8023 (patch)
treea3449b4b890ccfbc8dbe168a692acfac7c538511 /src/client/components
parentfix (diff)
downloadsharkey-7c38cda8eecaf1dd54971400d8cfb568a9dc8023.tar.gz
sharkey-7c38cda8eecaf1dd54971400d8cfb568a9dc8023.tar.bz2
sharkey-7c38cda8eecaf1dd54971400d8cfb568a9dc8023.zip
Refactor
Diffstat (limited to 'src/client/components')
-rw-r--r--src/client/components/notification.vue18
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));
}