Refactor server side notifications (#2327)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2022-10-26 17:24:39 +07:00
committed by GitHub
parent 70e00dbb5f
commit 3a8d1e2bcb
58 changed files with 539 additions and 400 deletions
+3 -5
View File
@@ -34,16 +34,16 @@ import { addAssigneeNotification } from '@hcengineering/server-task-resources'
/**
* @public
*/
export function leadHTMLPresenter (doc: Doc): string {
export async function leadHTMLPresenter (doc: Doc, control: TriggerControl): Promise<string> {
const lead = doc as Lead
const front = getMetadata(login.metadata.FrontUrl) ?? ''
return `<a href="${front}/${workbenchId}/${leadId}/${lead.space}/#${view.component.EditDoc}|${lead._id}|${lead._class}">${lead.title}</a>`
return `<a href="${front}/${workbenchId}/${control.workspace}/${leadId}/${lead.space}/#${view.component.EditDoc}|${lead._id}|${lead._class}">${lead.title}</a>`
}
/**
* @public
*/
export function leadTextPresenter (doc: Doc): string {
export async function leadTextPresenter (doc: Doc): Promise<string> {
const lead = doc as Lead
return `LEAD-${lead.number}`
}
@@ -77,7 +77,6 @@ async function handleLeadCreate (control: TriggerControl, cud: TxCUD<Doc>, res:
control,
res,
leadValue,
leadTextPresenter(leadValue),
leadValue.assignee,
tx as TxCollectionCUD<Lead, AttachedDoc>
)
@@ -96,7 +95,6 @@ async function handleLeadUpdate (control: TriggerControl, cud: TxCUD<Doc>, res:
control,
res,
leadValue,
leadTextPresenter(leadValue),
leadValue.assignee,
tx as TxCollectionCUD<Lead, AttachedDoc>
)