mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-29 19:56:18 +00:00
Use queryFind in isAllowed function in notification trigger (#5409)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
02cecb3820
commit
857d56bb0b
@ -140,17 +140,8 @@ export async function isAllowed (
|
||||
typeId: Ref<BaseNotificationType>,
|
||||
providerId: Ref<NotificationProvider>
|
||||
): Promise<boolean> {
|
||||
const setting = (
|
||||
await control.findAll(
|
||||
notification.class.NotificationSetting,
|
||||
{
|
||||
attachedTo: providerId,
|
||||
type: typeId,
|
||||
modifiedBy: receiver
|
||||
},
|
||||
{ limit: 1 }
|
||||
)
|
||||
)[0]
|
||||
const settings = await control.queryFind(notification.class.NotificationSetting, {})
|
||||
const setting = settings.find((p) => p.attachedTo === providerId && p.type === typeId && p.modifiedBy === receiver)
|
||||
if (setting !== undefined) {
|
||||
return setting.enabled
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user