mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 17:03:49 +01:00
Observe notification read
This commit is contained in:
parent
0b953284cb
commit
4a90d7cdf8
@ -90,9 +90,25 @@ export default Vue.extend({
|
|||||||
getNoteSummary: (text: string) => noteSummary(text, this.$root.i18n.messages[this.$root.i18n.locale]),
|
getNoteSummary: (text: string) => noteSummary(text, this.$root.i18n.messages[this.$root.i18n.locale]),
|
||||||
followRequestDone: false,
|
followRequestDone: false,
|
||||||
groupInviteDone: false,
|
groupInviteDone: false,
|
||||||
|
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
|
faIdCardAlt, faPlus, faQuoteLeft, faQuoteRight, faRetweet, faReply, faAt, faClock, faCheck, faPollH
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
if (!this.notification.isRead) this.readObserver.observe(this.$el);
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
if (!this.notification.isRead) this.readObserver.unobserve(this.$el);
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
acceptFollowRequest() {
|
acceptFollowRequest() {
|
||||||
this.followRequestDone = true;
|
this.followRequestDone = true;
|
||||||
|
@ -75,6 +75,8 @@ export default Vue.extend({
|
|||||||
this.$root.stream.send('readNotification', {
|
this.$root.stream.send('readNotification', {
|
||||||
id: notification.id
|
id: notification.id
|
||||||
});
|
});
|
||||||
|
|
||||||
|
notification.isRead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.prepend(notification);
|
this.prepend(notification);
|
||||||
|
Loading…
Reference in New Issue
Block a user