fix(oa): 同意/拒绝/打回前自动发送评论草稿
审批动作前冲刷评论区未发送内容,减少先点发送再审批的一步操作。 关联 #118。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0929164bf5
commit
a69dcc5bca
8 files changed
+137
-13
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { hasOaCommentDraft } from './oa-comment-draft.ts'
|
||||
|
||||
describe('hasOaCommentDraft', () => {
|
||||
it('treats blank content without mentions/files as empty', () => {
|
||||
assert.equal(hasOaCommentDraft({}), false)
|
||||
assert.equal(hasOaCommentDraft({ content: ' ', mentionCount: 0, attachmentCount: 0 }), false)
|
||||
})
|
||||
|
||||
it('detects text, mentions and attachments', () => {
|
||||
assert.equal(hasOaCommentDraft({ content: '@test' }), true)
|
||||
assert.equal(hasOaCommentDraft({ mentionCount: 1 }), true)
|
||||
assert.equal(hasOaCommentDraft({ attachmentCount: 2 }), true)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
/** 评论区是否有未发送草稿(文字 / @ / 附件) */
|
||||
export function hasOaCommentDraft(input: {
|
||||
content?: string | null
|
||||
mentionCount?: number
|
||||
attachmentCount?: number
|
||||
}): boolean {
|
||||
return !!(
|
||||
String(input.content || '').trim() ||
|
||||
(input.mentionCount || 0) > 0 ||
|
||||
(input.attachmentCount || 0) > 0
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user