refs #4797 refactor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-05-11 07:18:58 +02:00
parent 9cb756544e
commit 33ef9bdf61
1 changed files with 12 additions and 10 deletions

View File

@ -43,6 +43,11 @@ module.exports = Self => {
}
}, myOptions);
const activeNotifications = await models.NotificationSubscription.find({
include: {relation: 'notification'},
where: {userFk: id}
}, myOptions);
for (acl of availableNotifications) {
notifications.set(acl.notificationFk, {
id: null,
@ -53,17 +58,14 @@ module.exports = Self => {
});
}
const activeNotifications = await models.NotificationSubscription.find({
include: {relation: 'notification'},
where: {userFk: id}
}, myOptions);
for (subscription of activeNotifications) {
const notification = notifications.get(subscription.notificationFk);
if (notification) {
notification.active = true;
notification.id = subscription.id;
}
notifications.set(subscription.notificationFk, {
id: subscription.id,
notificationFk: subscription.notificationFk,
name: subscription.notification().name,
description: subscription.notification().description,
active: true,
});
}
return [...notifications.values()];