优化统一通知来源标题

This commit is contained in:
WuYongJie 2026-07-15 20:33:48 +08:00
parent 3266d983eb
commit d42c4cce84
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ test('通知中心验证签名、项目域名和幂等键', async () => {
const first = await fetch(`http://127.0.0.1:${port}${path}`, { method: 'POST', headers: headers('POST', path, body), body })
assert.equal(first.status, 202)
const firstPayload = await first.json() as any
assert.equal(firstPayload.title, '【由壹点·固定资产】待审批报废')
assert.equal(firstPayload.title, '【由壹点】固定资产·待审批报废')
const second = await fetch(`http://127.0.0.1:${port}${path}`, { method: 'POST', headers: headers('POST', path, body), body })
assert.equal(second.status, 200)

View File

@ -108,7 +108,7 @@ export const createServer = (projects: Map<string, ProjectConfig>) => {
if (title.length > 100 || content.length > 4800 || actionTitle.length > 20) return res.status(422).json({ error: 'MESSAGE_TOO_LONG' })
if (title.startsWith('【由壹点')) return res.status(422).json({ error: 'TITLE_BRAND_RESERVED' })
const renderedTitle = `【由壹点·${project.name}】${title}`
const renderedTitle = `【由壹点】${project.name}·${title}`
const normalized = { recipientUserId, title, content, actionTitle, actionUrl }
const requestHash = sha256(JSON.stringify(normalized))
const existing = await prisma.notificationDelivery.findUnique({