mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-10 03:37:43 +02:00
Adjust tg bot (#8412)
* Remove notification provider func Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Adjust tg-bot Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Use global integration Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Use workspace integration Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * getSocialIdBySocialKey -> findFullSocialIdBySocialKey Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * move findFullSocialIdBySocialKey to service operations Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * use listIntegrations with account token Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Adjust api Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> * Fxi tests Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> --------- Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -82,10 +82,10 @@ export function isUserEmployeeInFieldValueTypeMatch (
|
||||
type: NotificationType,
|
||||
control: TriggerControl
|
||||
): boolean {
|
||||
// TODO: check field type and compare with Ref<Person> or PersonId based on that
|
||||
if (type.field === undefined) return false
|
||||
const value = (doc as any)[type.field]
|
||||
if (value == null) return false
|
||||
if (value === person) return true
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
return includesAny(value, socialIds)
|
||||
@@ -121,7 +121,7 @@ function escapeRegExp (str: string): string {
|
||||
|
||||
export async function shouldNotifyCommon (
|
||||
control: TriggerControl,
|
||||
user: PersonId[],
|
||||
socialIds: PersonId[],
|
||||
typeId: Ref<CommonNotificationType>,
|
||||
notificationControl: NotificationProviderControl
|
||||
): Promise<NotifyResult> {
|
||||
@@ -135,7 +135,7 @@ export async function shouldNotifyCommon (
|
||||
const providers = await control.modelDb.findAll(notification.class.NotificationProvider, {})
|
||||
|
||||
for (const provider of providers) {
|
||||
const allowed = isAllowed(control, user, type, provider, notificationControl)
|
||||
const allowed = isAllowed(control, socialIds, type, provider, notificationControl)
|
||||
|
||||
if (allowed) {
|
||||
const cur = result.get(provider._id) ?? []
|
||||
|
||||
Reference in New Issue
Block a user