mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +00:00
fix(plugin-workflow-manual): allow pass node when no assignee (#4139)
This commit is contained in:
parent
b6940596f5
commit
8a2bcd9a74
@ -96,13 +96,17 @@ export default class extends Instruction {
|
||||
const assignees = [...new Set(processor.getParsedValue(config.assignees, node.id).flat().filter(Boolean))];
|
||||
|
||||
const job = await processor.saveJob({
|
||||
status: JOB_STATUS.PENDING,
|
||||
status: assignees.length ? JOB_STATUS.PENDING : JOB_STATUS.RESOLVED,
|
||||
result: mode ? [] : null,
|
||||
nodeId: node.id,
|
||||
nodeKey: node.key,
|
||||
upstreamId: prevJob?.id ?? null,
|
||||
});
|
||||
|
||||
if (!assignees.length) {
|
||||
return job;
|
||||
}
|
||||
|
||||
// NOTE: batch create users jobs
|
||||
const UserJobModel = this.workflow.app.db.getModel('users_jobs');
|
||||
await UserJobModel.bulkCreate(
|
||||
|
@ -50,6 +50,32 @@ describe('workflow > instructions > manual > assignees', () => {
|
||||
|
||||
afterEach(() => app.destroy());
|
||||
|
||||
describe('no', () => {
|
||||
it('empty assignees', async () => {
|
||||
const n1 = await workflow.createNode({
|
||||
type: 'manual',
|
||||
config: {
|
||||
assignees: [],
|
||||
forms: {
|
||||
f1: {
|
||||
actions: [{ status: JOB_STATUS.RESOLVED, key: 'resolve' }],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const post = await PostRepo.create({
|
||||
values: { title: 't1', category: { title: 'c1' } },
|
||||
context: { state: { currentUser: users[0] } },
|
||||
});
|
||||
|
||||
await sleep(500);
|
||||
|
||||
const [pending] = await workflow.getExecutions();
|
||||
expect(pending.status).toBe(EXECUTION_STATUS.RESOLVED);
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiple', () => {
|
||||
it('assignees from nested array', async () => {
|
||||
const n1 = await workflow.createNode({
|
||||
|
Loading…
Reference in New Issue
Block a user