Remove notify menu dot when notification has been seen

This commit is contained in:
Natsumi
2021-05-27 01:06:28 +12:00
parent 983cf41107
commit d9618b25ed

View File

@@ -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;