mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 08:33:09 +02:00
Refactor
This commit is contained in:
parent
d3f5001679
commit
7c38cda8ee
1 changed files with 11 additions and 9 deletions
|
@ -91,21 +91,23 @@ export default Vue.extend({
|
||||||
followRequestDone: false,
|
followRequestDone: false,
|
||||||
groupInviteDone: false,
|
groupInviteDone: false,
|
||||||
connection: null,
|
connection: null,
|
||||||
readObserver: new IntersectionObserver((entries, observer) => {
|
readObserver: null,
|
||||||
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
|
faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck, faPollH
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.notification.isRead) {
|
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));
|
||||||
|
})
|
||||||
|
|
||||||
this.readObserver.observe(this.$el);
|
this.readObserver.observe(this.$el);
|
||||||
|
|
||||||
this.connection = this.$root.stream.useSharedConnection('main');
|
this.connection = this.$root.stream.useSharedConnection('main');
|
||||||
this.connection.on('readAllNotifications', () => this.readObserver.unobserve(this.$el));
|
this.connection.on('readAllNotifications', () => this.readObserver.unobserve(this.$el));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue