diff --git a/html/src/app.js b/html/src/app.js
index 58b4fe0e..6913a844 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -2117,6 +2117,7 @@ speechSynthesis.getVoices();
this.getNotifications({ n: 100 }).then(() => {
this.deleteExpiredNotifcations();
this.isNotificationsLoading = false;
+ $app.unseenNotifications = [];
});
// this.bulk({
// fn: 'getNotifications',
@@ -3221,9 +3222,14 @@ speechSynthesis.getVoices();
notificationId: content.id
}
});
- if (content.type === 'invite') {
- $app.inviteDownloadWorldCache(content);
- }
+ break;
+
+ case 'notification-see':
+ this.$emit('NOTIFICATION:SEE', {
+ params: {
+ notificationId: content.notificationId
+ }
+ });
break;
case 'friend-add':
@@ -4702,6 +4708,9 @@ speechSynthesis.getVoices();
if (item) {
item.$el.classList.remove('notify');
}
+ if (index === 'notification') {
+ this.unseenNotifications = [];
+ }
};
$app.methods.promptTOTP = function () {
@@ -6911,6 +6920,8 @@ speechSynthesis.getVoices();
$app.notificationTable.data = [];
});
+ $app.data.unseenNotifications = [];
+
API.$on('NOTIFICATION', function (args) {
var { ref } = args;
var array = $app.notificationTable.data;
@@ -6927,11 +6938,22 @@ speechSynthesis.getVoices();
}
if (ref.$isDeleted === false) {
$app.notificationTable.data.push(ref);
- $app.notifyMenu('notification');
+ if (ref.senderUserId !== this.currentUser.id) {
+ $app.notifyMenu('notification');
+ $app.unseenNotifications.push(ref.id);
+ }
}
$app.updateSharedFeed(true);
});
+ API.$on('NOTIFICATION:SEE', function (args) {
+ var { notificationId } = args.params;
+ removeFromArray($app.unseenNotifications, notificationId);
+ if ($app.unseenNotifications.length === 0) {
+ $app.selectMenu('notification');
+ }
+ });
+
API.$on('NOTIFICATION:@DELETE', function (args) {
var { ref } = args;
var array = $app.notificationTable.data;