summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2020-05-26 15:00:15 +0900
committertamaina <tamaina@hotmail.co.jp>2020-05-26 15:00:15 +0900
commit974abbe826ee424fe99afc39b6d20afe5f4fe5db (patch)
treec1993c927f6f9a303e71678dc752a0c75fe74adf /src
parentObserve notification read (diff)
downloadsharkey-974abbe826ee424fe99afc39b6d20afe5f4fe5db.tar.gz
sharkey-974abbe826ee424fe99afc39b6d20afe5f4fe5db.tar.bz2
sharkey-974abbe826ee424fe99afc39b6d20afe5f4fe5db.zip
capture readAllNotifications
Diffstat (limited to 'src')
-rw-r--r--src/client/components/notification.vue9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/components/notification.vue b/src/client/components/notification.vue
index d0c85b6e2e..3c6b8524ea 100644
--- a/src/client/components/notification.vue
+++ b/src/client/components/notification.vue
@@ -90,6 +90,7 @@ export default Vue.extend({
getNoteSummary: (text: string) => noteSummary(text, this.$root.i18n.messages[this.$root.i18n.locale]),
followRequestDone: false,
groupInviteDone: false,
+ connection: null,
readObserver: new IntersectionObserver((entries, observer) => {
if (!entries.some(entry => entry.isIntersecting)) return;
this.$root.stream.send('readNotification', {
@@ -102,11 +103,17 @@ export default Vue.extend({
},
mounted() {
- if (!this.notification.isRead) this.readObserver.observe(this.$el);
+ 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));
+ }
},
beforeDestroy() {
if (!this.notification.isRead) this.readObserver.unobserve(this.$el);
+ this.connection.dispose();
},
methods: {