markup check filled (#10817)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2026-05-03 15:53:23 +05:00
committed by GitHub
parent 1dc41f0b1d
commit c6738a02cb
5 changed files with 66 additions and 0 deletions
@@ -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
}