This commit is contained in:
parent
9cb756544e
commit
33ef9bdf61
|
@ -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()];
|
||||
|
|
Loading…
Reference in New Issue