mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-01 22:15:04 +02:00
markup check filled (#10817)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -48,6 +48,7 @@ import process, {
|
||||
UserResult
|
||||
} from '@hcengineering/process'
|
||||
import { ExecuteResult, ProcessControl, SuccessExecutionContext } from '@hcengineering/server-process'
|
||||
import { isEmptyMarkup } from '@hcengineering/text-core'
|
||||
import time, { ToDoPriority } from '@hcengineering/time'
|
||||
|
||||
function checkResult (execution: Execution, results: Record<string, any> | undefined): boolean {
|
||||
@@ -146,10 +147,26 @@ export function MatchCardCheck (
|
||||
if (context.card === undefined) return false
|
||||
const process = control.client.getModel().findObject(execution.process)
|
||||
if (process === undefined) return false
|
||||
const markup = getMarkupParams(context.card, params, control)
|
||||
for (const key of Object.keys(markup)) {
|
||||
if (isEmptyMarkup(context.card[key])) return false
|
||||
}
|
||||
|
||||
const res = matchQuery([context.card], params, process.masterTag, control.client.getHierarchy(), true)
|
||||
return res.length > 0
|
||||
}
|
||||
|
||||
function getMarkupParams (card: Card, params: Record<string, any>, control: ProcessControl): Record<string, any> {
|
||||
const markup: Record<string, any> = {}
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
const attr = control.client.getHierarchy().findAttribute(card._class, key)
|
||||
if (attr?.type?._class === core.class.TypeMarkup) {
|
||||
markup[key] = value
|
||||
}
|
||||
}
|
||||
return markup
|
||||
}
|
||||
|
||||
export function EventCheck (
|
||||
control: ProcessControl,
|
||||
execution: Execution,
|
||||
@@ -173,6 +190,11 @@ export function FieldChangedCheck (
|
||||
const operations = context.operations as DocumentUpdate<Doc>
|
||||
const target = Object.keys(params)[0]
|
||||
if (!TxProcessor.hasUpdate(operations, target)) return false
|
||||
const markup = getMarkupParams(context.card, params, control)
|
||||
for (const key of Object.keys(markup)) {
|
||||
if (isEmptyMarkup(context.card[key])) return false
|
||||
}
|
||||
|
||||
const res = matchQuery([context.card], params, process.masterTag, control.client.getHierarchy(), true)
|
||||
return res.length > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user