mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-03 17:05:16 +03: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>,
|
typeId: Ref<BaseNotificationType>,
|
||||||
providerId: Ref<NotificationProvider>
|
providerId: Ref<NotificationProvider>
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const setting = (
|
const settings = await control.queryFind(notification.class.NotificationSetting, {})
|
||||||
await control.findAll(
|
const setting = settings.find((p) => p.attachedTo === providerId && p.type === typeId && p.modifiedBy === receiver)
|
||||||
notification.class.NotificationSetting,
|
|
||||||
{
|
|
||||||
attachedTo: providerId,
|
|
||||||
type: typeId,
|
|
||||||
modifiedBy: receiver
|
|
||||||
},
|
|
||||||
{ limit: 1 }
|
|
||||||
)
|
|
||||||
)[0]
|
|
||||||
if (setting !== undefined) {
|
if (setting !== undefined) {
|
||||||
return setting.enabled
|
return setting.enabled
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user