mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-11 21:11:57 +00:00
UBER-220 TG/GMAIL new message inbox notifications (#3246)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
30a0413dc3
commit
d8e69eb6bc
@ -36,6 +36,8 @@
|
|||||||
"@hcengineering/gmail-resources": "^0.6.0",
|
"@hcengineering/gmail-resources": "^0.6.0",
|
||||||
"@hcengineering/model-attachment": "^0.6.0",
|
"@hcengineering/model-attachment": "^0.6.0",
|
||||||
"@hcengineering/model-view": "^0.6.0",
|
"@hcengineering/model-view": "^0.6.0",
|
||||||
|
"@hcengineering/notification": "^0.6.12",
|
||||||
|
"@hcengineering/model-notification": "^0.6.0",
|
||||||
"@hcengineering/view": "^0.6.6",
|
"@hcengineering/view": "^0.6.6",
|
||||||
"@hcengineering/setting": "^0.6.7",
|
"@hcengineering/setting": "^0.6.7",
|
||||||
"@hcengineering/ui": "^0.6.8"
|
"@hcengineering/ui": "^0.6.8"
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
import attachment from '@hcengineering/model-attachment'
|
import attachment from '@hcengineering/model-attachment'
|
||||||
import contact from '@hcengineering/model-contact'
|
import contact from '@hcengineering/model-contact'
|
||||||
import core, { TAttachedDoc, TDoc } from '@hcengineering/model-core'
|
import core, { TAttachedDoc, TDoc } from '@hcengineering/model-core'
|
||||||
|
import notification from '@hcengineering/model-notification'
|
||||||
import view, { createAction } from '@hcengineering/model-view'
|
import view, { createAction } from '@hcengineering/model-view'
|
||||||
import setting from '@hcengineering/setting'
|
import setting from '@hcengineering/setting'
|
||||||
import gmail from './plugin'
|
import gmail from './plugin'
|
||||||
@ -213,6 +214,34 @@ export function createModel (builder: Builder): void {
|
|||||||
gmail.action.WriteEmail
|
gmail.action.WriteEmail
|
||||||
)
|
)
|
||||||
|
|
||||||
|
builder.createDoc(
|
||||||
|
notification.class.NotificationGroup,
|
||||||
|
core.space.Model,
|
||||||
|
{
|
||||||
|
label: gmail.string.Email,
|
||||||
|
icon: contact.icon.Email
|
||||||
|
},
|
||||||
|
gmail.ids.EmailNotificationGroup
|
||||||
|
)
|
||||||
|
|
||||||
|
builder.createDoc(
|
||||||
|
notification.class.NotificationType,
|
||||||
|
core.space.Model,
|
||||||
|
{
|
||||||
|
label: gmail.string.NewMessage,
|
||||||
|
generated: false,
|
||||||
|
hidden: false,
|
||||||
|
txClasses: [core.class.TxCreateDoc],
|
||||||
|
objectClass: gmail.class.Message,
|
||||||
|
group: gmail.ids.EmailNotificationGroup,
|
||||||
|
allowedForAuthor: true,
|
||||||
|
providers: {
|
||||||
|
[notification.providers.PlatformNotification]: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
gmail.ids.EmailNotification
|
||||||
|
)
|
||||||
|
|
||||||
builder.mixin(gmail.class.Message, core.class.Class, core.mixin.FullTextSearchContext, {
|
builder.mixin(gmail.class.Message, core.class.Class, core.mixin.FullTextSearchContext, {
|
||||||
parentPropagate: false
|
parentPropagate: false
|
||||||
})
|
})
|
||||||
|
@ -21,6 +21,7 @@ import gmail from '@hcengineering/gmail-resources/src/plugin'
|
|||||||
import type { AnyComponent } from '@hcengineering/ui'
|
import type { AnyComponent } from '@hcengineering/ui'
|
||||||
import type { TxViewlet } from '@hcengineering/activity'
|
import type { TxViewlet } from '@hcengineering/activity'
|
||||||
import { Action } from '@hcengineering/view'
|
import { Action } from '@hcengineering/view'
|
||||||
|
import { NotificationGroup } from '@hcengineering/notification'
|
||||||
|
|
||||||
export default mergeIds(gmailId, gmail, {
|
export default mergeIds(gmailId, gmail, {
|
||||||
action: {
|
action: {
|
||||||
@ -42,7 +43,8 @@ export default mergeIds(gmailId, gmail, {
|
|||||||
ConfigDescription: '' as IntlString
|
ConfigDescription: '' as IntlString
|
||||||
},
|
},
|
||||||
ids: {
|
ids: {
|
||||||
TxSharedCreate: '' as Ref<TxViewlet>
|
TxSharedCreate: '' as Ref<TxViewlet>,
|
||||||
|
EmailNotificationGroup: '' as Ref<NotificationGroup>
|
||||||
},
|
},
|
||||||
activity: {
|
activity: {
|
||||||
TxSharedCreate: '' as AnyComponent,
|
TxSharedCreate: '' as AnyComponent,
|
||||||
|
@ -46,7 +46,7 @@ export function createModel (builder: Builder): void {
|
|||||||
})
|
})
|
||||||
|
|
||||||
builder.mixin(chunter.ids.DMNotification, notification.class.NotificationType, serverNotification.mixin.TypeMatch, {
|
builder.mixin(chunter.ids.DMNotification, notification.class.NotificationType, serverNotification.mixin.TypeMatch, {
|
||||||
func: serverChunter.function.IsDirectMessagee
|
func: serverChunter.function.IsDirectMessage
|
||||||
})
|
})
|
||||||
|
|
||||||
builder.mixin(
|
builder.mixin(
|
||||||
@ -54,7 +54,7 @@ export function createModel (builder: Builder): void {
|
|||||||
notification.class.NotificationType,
|
notification.class.NotificationType,
|
||||||
serverNotification.mixin.TypeMatch,
|
serverNotification.mixin.TypeMatch,
|
||||||
{
|
{
|
||||||
func: serverChunter.function.IsChannelMessagee
|
func: serverChunter.function.IsChannelMessage
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
"@hcengineering/contact": "^0.6.16",
|
"@hcengineering/contact": "^0.6.16",
|
||||||
"@hcengineering/platform": "^0.6.9",
|
"@hcengineering/platform": "^0.6.9",
|
||||||
"@hcengineering/server-gmail": "^0.6.0",
|
"@hcengineering/server-gmail": "^0.6.0",
|
||||||
"@hcengineering/server-core": "^0.6.1"
|
"@hcengineering/server-core": "^0.6.1",
|
||||||
|
"@hcengineering/notification": "^0.6.12",
|
||||||
|
"@hcengineering/server-notification": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,10 @@ import { Builder } from '@hcengineering/model'
|
|||||||
import contact from '@hcengineering/contact'
|
import contact from '@hcengineering/contact'
|
||||||
import core, { Class, Doc } from '@hcengineering/core'
|
import core, { Class, Doc } from '@hcengineering/core'
|
||||||
import gmail from '@hcengineering/gmail'
|
import gmail from '@hcengineering/gmail'
|
||||||
|
import notification from '@hcengineering/notification'
|
||||||
import serverCore, { ObjectDDParticipant } from '@hcengineering/server-core'
|
import serverCore, { ObjectDDParticipant } from '@hcengineering/server-core'
|
||||||
import serverGmail from '@hcengineering/server-gmail'
|
import serverGmail from '@hcengineering/server-gmail'
|
||||||
|
import serverNotification from '@hcengineering/server-notification'
|
||||||
export { serverGmailId } from '@hcengineering/server-gmail'
|
export { serverGmailId } from '@hcengineering/server-gmail'
|
||||||
|
|
||||||
export function createModel (builder: Builder): void {
|
export function createModel (builder: Builder): void {
|
||||||
@ -40,4 +42,8 @@ export function createModel (builder: Builder): void {
|
|||||||
'tx._class': core.class.TxCreateDoc
|
'tx._class': core.class.TxCreateDoc
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.mixin(gmail.ids.EmailNotification, notification.class.NotificationType, serverNotification.mixin.TypeMatch, {
|
||||||
|
func: serverGmail.function.IsIncomingMessage
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
"@hcengineering/platform": "^0.6.9",
|
"@hcengineering/platform": "^0.6.9",
|
||||||
"@hcengineering/server-telegram": "^0.6.0",
|
"@hcengineering/server-telegram": "^0.6.0",
|
||||||
"@hcengineering/server-core": "^0.6.1",
|
"@hcengineering/server-core": "^0.6.1",
|
||||||
"@hcengineering/telegram": "^0.6.9"
|
"@hcengineering/telegram": "^0.6.9",
|
||||||
|
"@hcengineering/notification": "^0.6.12",
|
||||||
|
"@hcengineering/server-notification": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ import core, { Class, Doc } from '@hcengineering/core'
|
|||||||
import serverCore, { ObjectDDParticipant } from '@hcengineering/server-core'
|
import serverCore, { ObjectDDParticipant } from '@hcengineering/server-core'
|
||||||
import serverTelegram from '@hcengineering/server-telegram'
|
import serverTelegram from '@hcengineering/server-telegram'
|
||||||
import telegram from '@hcengineering/telegram'
|
import telegram from '@hcengineering/telegram'
|
||||||
|
import notification from '@hcengineering/notification'
|
||||||
|
import serverNotification from '@hcengineering/server-notification'
|
||||||
|
|
||||||
export { serverTelegramId } from '@hcengineering/server-telegram'
|
export { serverTelegramId } from '@hcengineering/server-telegram'
|
||||||
|
|
||||||
@ -41,4 +43,13 @@ export function createModel (builder: Builder): void {
|
|||||||
'tx._class': core.class.TxCreateDoc
|
'tx._class': core.class.TxCreateDoc
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.mixin(
|
||||||
|
telegram.ids.NewMessageNotification,
|
||||||
|
notification.class.NotificationType,
|
||||||
|
serverNotification.mixin.TypeMatch,
|
||||||
|
{
|
||||||
|
func: serverTelegram.function.IsIncomingMessage
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
"@hcengineering/platform": "^0.6.9",
|
"@hcengineering/platform": "^0.6.9",
|
||||||
"@hcengineering/model-core": "^0.6.0",
|
"@hcengineering/model-core": "^0.6.0",
|
||||||
"@hcengineering/model-attachment": "^0.6.0",
|
"@hcengineering/model-attachment": "^0.6.0",
|
||||||
|
"@hcengineering/model-notification": "^0.6.0",
|
||||||
|
"@hcengineering/notification": "^0.6.12",
|
||||||
"@hcengineering/model-contact": "^0.6.1",
|
"@hcengineering/model-contact": "^0.6.1",
|
||||||
"@hcengineering/view": "^0.6.6",
|
"@hcengineering/view": "^0.6.6",
|
||||||
"@hcengineering/contact": "^0.6.16",
|
"@hcengineering/contact": "^0.6.16",
|
||||||
|
@ -41,6 +41,7 @@ import type {
|
|||||||
import templates from '@hcengineering/templates'
|
import templates from '@hcengineering/templates'
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
import telegram from './plugin'
|
import telegram from './plugin'
|
||||||
|
import notification from '@hcengineering/model-notification'
|
||||||
|
|
||||||
export { telegramId } from '@hcengineering/telegram'
|
export { telegramId } from '@hcengineering/telegram'
|
||||||
export { telegramOperation } from './migration'
|
export { telegramOperation } from './migration'
|
||||||
@ -175,6 +176,34 @@ export function createModel (builder: Builder): void {
|
|||||||
telegram.ids.TxSharedCreate
|
telegram.ids.TxSharedCreate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
builder.createDoc(
|
||||||
|
notification.class.NotificationGroup,
|
||||||
|
core.space.Model,
|
||||||
|
{
|
||||||
|
label: telegram.string.Telegram,
|
||||||
|
icon: contact.icon.Telegram
|
||||||
|
},
|
||||||
|
telegram.ids.NotificationGroup
|
||||||
|
)
|
||||||
|
|
||||||
|
builder.createDoc(
|
||||||
|
notification.class.NotificationType,
|
||||||
|
core.space.Model,
|
||||||
|
{
|
||||||
|
label: telegram.string.NewMessage,
|
||||||
|
generated: false,
|
||||||
|
allowedForAuthor: true,
|
||||||
|
hidden: false,
|
||||||
|
txClasses: [core.class.TxCreateDoc],
|
||||||
|
objectClass: telegram.class.Message,
|
||||||
|
group: telegram.ids.NotificationGroup,
|
||||||
|
providers: {
|
||||||
|
[notification.providers.PlatformNotification]: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
telegram.ids.NewMessageNotification
|
||||||
|
)
|
||||||
|
|
||||||
builder.mixin(telegram.class.Message, core.class.Class, core.mixin.FullTextSearchContext, {
|
builder.mixin(telegram.class.Message, core.class.Class, core.mixin.FullTextSearchContext, {
|
||||||
parentPropagate: false
|
parentPropagate: false
|
||||||
})
|
})
|
||||||
|
@ -21,6 +21,7 @@ import telegram from '@hcengineering/telegram-resources/src/plugin'
|
|||||||
import type { AnyComponent } from '@hcengineering/ui'
|
import type { AnyComponent } from '@hcengineering/ui'
|
||||||
import type { TxViewlet } from '@hcengineering/activity'
|
import type { TxViewlet } from '@hcengineering/activity'
|
||||||
import { TemplateFieldFunc } from '@hcengineering/templates'
|
import { TemplateFieldFunc } from '@hcengineering/templates'
|
||||||
|
import { NotificationGroup } from '@hcengineering/notification'
|
||||||
|
|
||||||
export default mergeIds(telegramId, telegram, {
|
export default mergeIds(telegramId, telegram, {
|
||||||
string: {
|
string: {
|
||||||
@ -33,11 +34,13 @@ export default mergeIds(telegramId, telegram, {
|
|||||||
TelegramIntegrationDesc: '' as IntlString,
|
TelegramIntegrationDesc: '' as IntlString,
|
||||||
Status: '' as IntlString,
|
Status: '' as IntlString,
|
||||||
ConfigLabel: '' as IntlString,
|
ConfigLabel: '' as IntlString,
|
||||||
ConfigDescription: '' as IntlString
|
ConfigDescription: '' as IntlString,
|
||||||
|
NewMessage: '' as IntlString
|
||||||
},
|
},
|
||||||
ids: {
|
ids: {
|
||||||
TxMessage: '' as Ref<TxViewlet>,
|
TxMessage: '' as Ref<TxViewlet>,
|
||||||
TxSharedCreate: '' as Ref<TxViewlet>
|
TxSharedCreate: '' as Ref<TxViewlet>,
|
||||||
|
NotificationGroup: '' as Ref<NotificationGroup>
|
||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
GetCurrentEmployeeTG: '' as Resource<TemplateFieldFunc>,
|
GetCurrentEmployeeTG: '' as Resource<TemplateFieldFunc>,
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"@hcengineering/core": "^0.6.25",
|
"@hcengineering/core": "^0.6.25",
|
||||||
"@hcengineering/ui": "^0.6.8",
|
"@hcengineering/ui": "^0.6.8",
|
||||||
"@hcengineering/contact": "^0.6.16",
|
"@hcengineering/contact": "^0.6.16",
|
||||||
|
"@hcengineering/notification": "^0.6.12",
|
||||||
"@hcengineering/setting": "^0.6.7"
|
"@hcengineering/setting": "^0.6.7"
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/hcengineering/anticrm",
|
"repository": "https://github.com/hcengineering/anticrm",
|
||||||
|
@ -17,6 +17,7 @@ import { ChannelItem } from '@hcengineering/contact'
|
|||||||
import type { Account, AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
|
import type { Account, AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
|
||||||
import type { Plugin } from '@hcengineering/platform'
|
import type { Plugin } from '@hcengineering/platform'
|
||||||
import { Metadata, plugin } from '@hcengineering/platform'
|
import { Metadata, plugin } from '@hcengineering/platform'
|
||||||
|
import { NotificationType } from '@hcengineering/notification'
|
||||||
import type { Handler, IntegrationType } from '@hcengineering/setting'
|
import type { Handler, IntegrationType } from '@hcengineering/setting'
|
||||||
import type { AnyComponent } from '@hcengineering/ui'
|
import type { AnyComponent } from '@hcengineering/ui'
|
||||||
|
|
||||||
@ -99,6 +100,9 @@ export default plugin(gmailId, {
|
|||||||
SharedMessages: '' as Ref<Class<SharedMessages>>,
|
SharedMessages: '' as Ref<Class<SharedMessages>>,
|
||||||
SharedMessage: '' as Ref<Class<SharedMessage>>
|
SharedMessage: '' as Ref<Class<SharedMessage>>
|
||||||
},
|
},
|
||||||
|
ids: {
|
||||||
|
EmailNotification: '' as Ref<NotificationType>
|
||||||
|
},
|
||||||
space: {
|
space: {
|
||||||
Gmail: '' as Ref<Space>
|
Gmail: '' as Ref<Space>
|
||||||
},
|
},
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"Content": "Content",
|
"Content": "Content",
|
||||||
"Incoming": "Incoming",
|
"Incoming": "Incoming",
|
||||||
"Messages": "Messages",
|
"Messages": "Messages",
|
||||||
|
"NewMessage": "New message",
|
||||||
"Telegram": "Telegram",
|
"Telegram": "Telegram",
|
||||||
"TelegramIntegrationDesc": "Use telegram integration",
|
"TelegramIntegrationDesc": "Use telegram integration",
|
||||||
"Status": "Status",
|
"Status": "Status",
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"Content": "Содержимое",
|
"Content": "Содержимое",
|
||||||
"Incoming": "Входящее",
|
"Incoming": "Входящее",
|
||||||
"Messages": "Сообщения",
|
"Messages": "Сообщения",
|
||||||
|
"NewMessage": "Новое сообщение",
|
||||||
"Telegram": "Telegram",
|
"Telegram": "Telegram",
|
||||||
"TelegramIntegrationDesc": "Подключить Telegram",
|
"TelegramIntegrationDesc": "Подключить Telegram",
|
||||||
"Status": "Статус",
|
"Status": "Статус",
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"@hcengineering/core": "^0.6.25",
|
"@hcengineering/core": "^0.6.25",
|
||||||
"@hcengineering/ui": "^0.6.8",
|
"@hcengineering/ui": "^0.6.8",
|
||||||
"@hcengineering/contact": "^0.6.16",
|
"@hcengineering/contact": "^0.6.16",
|
||||||
|
"@hcengineering/notification": "^0.6.12",
|
||||||
"@hcengineering/templates": "^0.6.4",
|
"@hcengineering/templates": "^0.6.4",
|
||||||
"@hcengineering/setting": "^0.6.7"
|
"@hcengineering/setting": "^0.6.7"
|
||||||
},
|
},
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import { ChannelItem } from '@hcengineering/contact'
|
import { ChannelItem } from '@hcengineering/contact'
|
||||||
import type { AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
|
import type { AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
|
||||||
|
import { NotificationType } from '@hcengineering/notification'
|
||||||
import type { Plugin } from '@hcengineering/platform'
|
import type { Plugin } from '@hcengineering/platform'
|
||||||
import { Metadata, plugin } from '@hcengineering/platform'
|
import { Metadata, plugin } from '@hcengineering/platform'
|
||||||
import type { Handler, IntegrationType } from '@hcengineering/setting'
|
import type { Handler, IntegrationType } from '@hcengineering/setting'
|
||||||
@ -75,6 +76,9 @@ export default plugin(telegramId, {
|
|||||||
handler: {
|
handler: {
|
||||||
DisconnectHandler: '' as Handler
|
DisconnectHandler: '' as Handler
|
||||||
},
|
},
|
||||||
|
ids: {
|
||||||
|
NewMessageNotification: '' as Ref<NotificationType>
|
||||||
|
},
|
||||||
class: {
|
class: {
|
||||||
Message: '' as Ref<Class<TelegramMessage>>,
|
Message: '' as Ref<Class<TelegramMessage>>,
|
||||||
NewMessage: '' as Ref<Class<NewTelegramMessage>>,
|
NewMessage: '' as Ref<Class<NewTelegramMessage>>,
|
||||||
|
@ -207,7 +207,7 @@ export async function ChunterTrigger (tx: Tx, control: TriggerControl): Promise<
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function IsDirectMessagee (
|
export async function IsDirectMessage (
|
||||||
tx: Tx,
|
tx: Tx,
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
user: Ref<Account>,
|
user: Ref<Account>,
|
||||||
@ -221,7 +221,7 @@ export async function IsDirectMessagee (
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function IsChannelMessagee (
|
export async function IsChannelMessage (
|
||||||
tx: Tx,
|
tx: Tx,
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
user: Ref<Account>,
|
user: Ref<Account>,
|
||||||
@ -241,7 +241,7 @@ export default async () => ({
|
|||||||
CommentRemove,
|
CommentRemove,
|
||||||
ChannelHTMLPresenter: channelHTMLPresenter,
|
ChannelHTMLPresenter: channelHTMLPresenter,
|
||||||
ChannelTextPresenter: channelTextPresenter,
|
ChannelTextPresenter: channelTextPresenter,
|
||||||
IsDirectMessagee,
|
IsDirectMessage,
|
||||||
IsChannelMessagee
|
IsChannelMessage
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -45,7 +45,7 @@ export default plugin(serverChunterId, {
|
|||||||
>,
|
>,
|
||||||
ChannelHTMLPresenter: '' as Resource<Presenter>,
|
ChannelHTMLPresenter: '' as Resource<Presenter>,
|
||||||
ChannelTextPresenter: '' as Resource<Presenter>,
|
ChannelTextPresenter: '' as Resource<Presenter>,
|
||||||
IsDirectMessagee: '' as TypeMatchFunc,
|
IsDirectMessage: '' as TypeMatchFunc,
|
||||||
IsChannelMessagee: '' as TypeMatchFunc
|
IsChannelMessage: '' as TypeMatchFunc
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import contact, { Channel } from '@hcengineering/contact'
|
import contact, { Channel } from '@hcengineering/contact'
|
||||||
import {
|
import {
|
||||||
|
Account,
|
||||||
Class,
|
Class,
|
||||||
Doc,
|
Doc,
|
||||||
DocumentQuery,
|
DocumentQuery,
|
||||||
@ -29,7 +30,7 @@ import {
|
|||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import gmail, { Message } from '@hcengineering/gmail'
|
import gmail, { Message } from '@hcengineering/gmail'
|
||||||
import { TriggerControl } from '@hcengineering/server-core'
|
import { TriggerControl } from '@hcengineering/server-core'
|
||||||
import notification from '@hcengineering/notification'
|
import notification, { NotificationType } from '@hcengineering/notification'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -115,9 +116,24 @@ export async function OnMessageCreate (tx: Tx, control: TriggerControl): Promise
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export async function IsIncomingMessage (
|
||||||
|
tx: Tx,
|
||||||
|
doc: Doc,
|
||||||
|
user: Ref<Account>,
|
||||||
|
type: NotificationType,
|
||||||
|
control: TriggerControl
|
||||||
|
): Promise<boolean> {
|
||||||
|
const message = doc as Message
|
||||||
|
return message.incoming
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||||
export default async () => ({
|
export default async () => ({
|
||||||
trigger: {
|
trigger: {
|
||||||
|
IsIncomingMessage,
|
||||||
OnMessageCreate
|
OnMessageCreate
|
||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hcengineering/core": "^0.6.25",
|
"@hcengineering/core": "^0.6.25",
|
||||||
"@hcengineering/platform": "^0.6.9",
|
"@hcengineering/platform": "^0.6.9",
|
||||||
|
"@hcengineering/server-notification": "^0.6.0",
|
||||||
"@hcengineering/server-core": "^0.6.1"
|
"@hcengineering/server-core": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
||||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||||
import { plugin } from '@hcengineering/platform'
|
import { plugin } from '@hcengineering/platform'
|
||||||
|
import { TypeMatchFunc } from '@hcengineering/server-notification'
|
||||||
import { TriggerFunc } from '@hcengineering/server-core'
|
import { TriggerFunc } from '@hcengineering/server-core'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,6 +33,7 @@ export default plugin(serverGmailId, {
|
|||||||
OnMessageCreate: '' as Resource<TriggerFunc>
|
OnMessageCreate: '' as Resource<TriggerFunc>
|
||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
|
IsIncomingMessage: '' as TypeMatchFunc,
|
||||||
FindMessages: '' as Resource<
|
FindMessages: '' as Resource<
|
||||||
(
|
(
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import contact, { Channel } from '@hcengineering/contact'
|
import contact, { Channel } from '@hcengineering/contact'
|
||||||
import {
|
import {
|
||||||
|
Account,
|
||||||
Class,
|
Class,
|
||||||
Doc,
|
Doc,
|
||||||
DocumentQuery,
|
DocumentQuery,
|
||||||
@ -29,7 +30,7 @@ import {
|
|||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { TriggerControl } from '@hcengineering/server-core'
|
import { TriggerControl } from '@hcengineering/server-core'
|
||||||
import telegram, { TelegramMessage } from '@hcengineering/telegram'
|
import telegram, { TelegramMessage } from '@hcengineering/telegram'
|
||||||
import notification from '@hcengineering/notification'
|
import notification, { NotificationType } from '@hcengineering/notification'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -113,12 +114,27 @@ export async function OnMessageCreate (tx: Tx, control: TriggerControl): Promise
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export async function IsIncomingMessage (
|
||||||
|
tx: Tx,
|
||||||
|
doc: Doc,
|
||||||
|
user: Ref<Account>,
|
||||||
|
type: NotificationType,
|
||||||
|
control: TriggerControl
|
||||||
|
): Promise<boolean> {
|
||||||
|
const message = doc as TelegramMessage
|
||||||
|
return message.incoming
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||||
export default async () => ({
|
export default async () => ({
|
||||||
trigger: {
|
trigger: {
|
||||||
OnMessageCreate
|
OnMessageCreate
|
||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
|
IsIncomingMessage,
|
||||||
FindMessages
|
FindMessages
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hcengineering/core": "^0.6.25",
|
"@hcengineering/core": "^0.6.25",
|
||||||
"@hcengineering/platform": "^0.6.9",
|
"@hcengineering/platform": "^0.6.9",
|
||||||
|
"@hcengineering/server-notification": "^0.6.0",
|
||||||
"@hcengineering/server-core": "^0.6.1"
|
"@hcengineering/server-core": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
import { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref } from '@hcengineering/core'
|
||||||
import type { Plugin, Resource } from '@hcengineering/platform'
|
import type { Plugin, Resource } from '@hcengineering/platform'
|
||||||
import { plugin } from '@hcengineering/platform'
|
import { plugin } from '@hcengineering/platform'
|
||||||
|
import { TypeMatchFunc } from '@hcengineering/server-notification'
|
||||||
import { TriggerFunc } from '@hcengineering/server-core'
|
import { TriggerFunc } from '@hcengineering/server-core'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,6 +33,7 @@ export default plugin(serverTelegramId, {
|
|||||||
OnMessageCreate: '' as Resource<TriggerFunc>
|
OnMessageCreate: '' as Resource<TriggerFunc>
|
||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
|
IsIncomingMessage: '' as TypeMatchFunc,
|
||||||
FindMessages: '' as Resource<
|
FindMessages: '' as Resource<
|
||||||
(
|
(
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
|
Loading…
Reference in New Issue
Block a user