fix: submit to workflow error (#1163) fix #1162

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1163
This commit is contained in:
sealday 2024-06-12 14:24:18 +08:00
parent c15e594855
commit d7a3142ada

View File

@ -1,4 +1,4 @@
import actions, { Context, utils } from '@tachybase/actions'; import actions, { Context, Next, utils } from '@tachybase/actions';
import { Op, Repository } from '@tachybase/database'; import { Op, Repository } from '@tachybase/database';
import Plugin from '../Plugin'; import Plugin from '../Plugin';
@ -161,7 +161,8 @@ export async function sync(context: Context, next) {
await next(); await next();
} }
export async function trigger(ctx: Context) { export async function trigger(ctx: Context, next: Next) {
if (!ctx.action.params.triggerWorkflows) {
const plugin = ctx.app.getPlugin(Plugin) as Plugin; const plugin = ctx.app.getPlugin(Plugin) as Plugin;
const workflow = (await ctx.db.getRepository('workflows').findById(ctx.action.params.filterByTk)) as WorkflowModel; const workflow = (await ctx.db.getRepository('workflows').findById(ctx.action.params.filterByTk)) as WorkflowModel;
// NOTE: 这里的updateData是通过前端传过来的需要 decodeURIComponent, // NOTE: 这里的updateData是通过前端传过来的需要 decodeURIComponent,
@ -178,4 +179,7 @@ export async function trigger(ctx: Context) {
}, },
{ httpContext: ctx }, { httpContext: ctx },
); );
} else {
await next();
}
} }