Fix email notification (#6425)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2024-08-28 22:44:14 +07:00
committed by GitHub
parent daac4666db
commit ee4bbb055d
8 changed files with 125 additions and 69 deletions
+3 -2
View File
@@ -25,7 +25,7 @@ import IconGmail from './components/icons/GmailColor.svelte'
import Main from './components/Main.svelte'
import NewMessages from './components/NewMessages.svelte'
import gmail from '@hcengineering/gmail'
import { checkHasEmail } from './utils'
import { checkHasEmail, MessageTitleProvider } from './utils'
export default async (): Promise<Resources> => ({
component: {
@@ -40,7 +40,8 @@ export default async (): Promise<Resources> => ({
GmailSharedMessage
},
function: {
HasEmail: checkHasEmail
HasEmail: checkHasEmail,
MessageTitleProvider
},
handler: {
DisconnectHandler: async () => {
+7 -1
View File
@@ -5,7 +5,7 @@ import contact, {
type PersonAccount,
getName as getContactName
} from '@hcengineering/contact'
import { type Doc, type IdMap, type Ref, toIdMap } from '@hcengineering/core'
import { type Client, type Doc, type IdMap, type Ref, toIdMap } from '@hcengineering/core'
import { type Message, type SharedMessage } from '@hcengineering/gmail'
import { getClient } from '@hcengineering/presentation'
import gmail from './plugin'
@@ -129,3 +129,9 @@ export function getName (
return emp != null ? `${getContactName(h, emp)} (${emailVal})` : emailVal
}
}
export async function MessageTitleProvider (client: Client, ref: Ref<Message>, doc?: Message): Promise<string> {
const object = doc ?? (await client.findOne(gmail.class.Message, { _id: ref }))
return object?.subject ?? ''
}