Skip to content

feat(workflow): support custom external approval titles#4813

Open
Cynthia-0203 wants to merge 7 commits into
koderover:mainfrom
Cynthia-0203:feat/custom-approval-title
Open

feat(workflow): support custom external approval titles#4813
Cynthia-0203 wants to merge 7 commits into
koderover:mainfrom
Cynthia-0203:feat/custom-approval-title

Conversation

@Cynthia-0203

@Cynthia-0203 Cynthia-0203 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What this PR does / Why we need it:

Supports custom approval titles for external approval jobs, so users can define clearer titles for Lark, DingTalk, and WorkWX approvals.

What is changed and how it works?

  • Adds approval_title to workflow approval job specs and task specs.
  • Uses the custom title when creating Lark approval definitions.

Does this PR introduce a user-facing change?

  • API change
  • database schema change
  • upgrade assistant change
  • change in non-functional attributes such as efficiency or availability
  • fix of a previous issue

This change is Reviewable

Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
return nodeTypeKey
}

return fmt.Sprintf("%s-%x", nodeTypeKey, md5.Sum([]byte(title)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个要md5做什么?审批定义有什么限制吗?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有限制,只是这样固定标题生成key的长度而已

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那直接用标题原文不就可以了?md5后存在数据库里没法阅读,不好debug

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那我优化一下

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经改了

Signed-off-by: Cynthia <chenchen@koderover.com>
Comment on lines +1578 to +1582
approvalTitle := strings.TrimSpace(spec.ApprovalTitle)
if approvalTitle == "" {
approvalTitle = "Zadig 工作流"
}
approvalNodeTypeKey := data.GetNodeTypeTitleKey(spec.ApprovalTitle)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approvalTitle为空的时候,会设置为Zadig 工作流,导致GetNodeTypeTitleKey无法继续使用默认的NodeTypeKey

return config.StatusTimeout, fmt.Errorf("workflow timeout")
default:
userApprovalResult, err := workwxservice.GetWorkWXApprovalEvent(instanceID)
detail, err := client.GetApprovalDetail(instanceID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不从event推送中获取审批结果了吗?需要查看一下workwx这个接口的rate limit,会不会造成问题

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对的,因为企微需要在后台选择需要回调的模版,比如修改了标题之后创建了一个模版但是没在企微后台勾选的话是没法获得回调信息的只能主动去查询。接口的限制是 600次/分钟。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在每1s查一次,只能并发10个企微审批,稍微有一点危险

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants