Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions models/card/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,12 @@ export function createModel (builder: Builder): void {
group: card.ids.CardNotificationGroup,
txClasses: [core.class.TxUpdateDoc, core.class.TxMixin],
objectClass: card.class.Card,
defaultEnabled: false
defaultEnabled: false,
templates: {
textTemplate: '{body}',
htmlTemplate: '<p>{body}</p><p>{link}</p>',
subjectTemplate: '{title} updated'
}
},
card.ids.CardNotification
)
Expand All @@ -485,7 +490,12 @@ export function createModel (builder: Builder): void {
txClasses: [core.class.TxCreateDoc],
objectClass: chunter.class.ChatMessage,
attachedToClass: card.class.Card,
defaultEnabled: true
defaultEnabled: true,
templates: {
textTemplate: 'New message in {title} ({link}) from {senderName}: {message}',
htmlTemplate: '<p>New message in <b>{title}</b> <b>from {senderName}</b>: {message}<p>{link}</p>',
subjectTemplate: 'New message from {senderName} in {title}'
}
},
card.ids.CardMessageNotification
)
Expand Down
4 changes: 4 additions & 0 deletions models/server-card/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,8 @@ export function createModel (builder: Builder): void {
builder.mixin(card.class.Card, core.class.Class, serverNotification.mixin.TextPresenter, {
presenter: serverCard.function.CardTextPresenter
})

builder.mixin(card.class.Card, core.class.Class, serverNotification.mixin.HTMLPresenter, {
presenter: serverCard.function.CardHTMLPresenter
})
}
1 change: 1 addition & 0 deletions server-plugins/card-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@hcengineering/core": "workspace:^0.7.24",
"@hcengineering/platform": "workspace:^0.7.19",
"@hcengineering/server-core": "workspace:^0.7.18",
"@hcengineering/workbench": "workspace:^0.7.0",
"@hcengineering/communication-types": "workspace:^0.7.12",
"@hcengineering/communication-sdk-types": "workspace:^0.7.12",
"@hcengineering/communication": "workspace:^0.7.0",
Expand Down
21 changes: 18 additions & 3 deletions server-plugins/card-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
// limitations under the License.
//

import card, { Card, MasterTag, Tag } from '@hcengineering/card'
import card, { Card, cardId, MasterTag, Tag } from '@hcengineering/card'
import core, {
AccountUuid,
AnyAttribute,
ArrOf,
Class,
concatLink,
Data,
Doc,
DocumentUpdate,
Expand All @@ -41,8 +42,9 @@ import core, {
TxRemoveDoc,
TxUpdateDoc
} from '@hcengineering/core'
import { TriggerControl } from '@hcengineering/server-core'
import serverCore, { TriggerControl } from '@hcengineering/server-core'
import setting from '@hcengineering/setting'
import { workbenchId } from '@hcengineering/workbench'
import view from '@hcengineering/view'
import {
AddCollaboratorsEvent,
Expand All @@ -59,6 +61,7 @@ import { getEmployee, getPersonSpaces } from '@hcengineering/server-contact'
import contact, { Employee, formatName, Person } from '@hcengineering/contact'
import communication, { Direct } from '@hcengineering/communication'
import { CardPeer } from '@hcengineering/communication-types'
import { getMetadata } from '@hcengineering/platform'

async function OnAttribute (ctx: TxCreateDoc<AnyAttribute>[], control: TriggerControl): Promise<Tx[]> {
const attr = TxProcessor.createDoc2Doc(ctx[0])
Expand Down Expand Up @@ -882,10 +885,22 @@ export async function CardTextPresenter (doc: Doc): Promise<string> {
return card.title
}

export async function CardHTMLPresenter (doc: Doc, control: TriggerControl): Promise<string> {
const card = doc as Card

const front = control.branding?.front ?? getMetadata(serverCore.metadata.FrontUrl) ?? ''

const path = `${workbenchId}/${control.workspace.url}/${cardId}/${card._id}`

const link = concatLink(front, path)
return `<a href='${link}'>${card.title}</a>`
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export default async () => ({
function: {
CardTextPresenter
CardTextPresenter,
CardHTMLPresenter
},
trigger: {
OnAttribute,
Expand Down
3 changes: 2 additions & 1 deletion server-plugins/card/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default plugin(serverCardId, {
CommunicationEnabled: '' as Metadata<boolean>
},
function: {
CardTextPresenter: '' as Resource<Presenter>
CardTextPresenter: '' as Resource<Presenter>,
CardHTMLPresenter: '' as Resource<Presenter>
},
trigger: {
OnAttribute: '' as Resource<TriggerFunc>,
Expand Down
Loading