R18-4/R21-2: 收口企微脱敏通知与 Portal 搜索摘要
这个提交包含在:
@@ -75,6 +75,32 @@ function buildImDedupeKey({ notificationType, targetType, targetId, targetPath,
|
||||
].join(':');
|
||||
}
|
||||
|
||||
function redactImMessage(config, payload) {
|
||||
const effectiveType = String(payload?.entityType ?? payload?.targetType ?? '').trim();
|
||||
const rawTitle = String(payload?.title ?? '系统通知').slice(0, 200);
|
||||
const rawBody = payload?.body == null ? '' : String(payload.body);
|
||||
|
||||
if (!config?.publicSecurityHardeningEnabled) {
|
||||
return { title: rawTitle, body: rawBody.slice(0, 4000) };
|
||||
}
|
||||
|
||||
if (effectiveType === 'project') {
|
||||
return {
|
||||
title: rawTitle || '项目待处理事项',
|
||||
body: '',
|
||||
};
|
||||
}
|
||||
|
||||
if (['contract_registry', 'confidential_doc_ref'].includes(effectiveType)) {
|
||||
return {
|
||||
title: '有待处理事项',
|
||||
body: `事项编号:${String(payload?.targetId ?? payload?.entityId ?? '-').slice(0, 80)}`,
|
||||
};
|
||||
}
|
||||
|
||||
return { title: rawTitle, body: rawBody.slice(0, 4000) };
|
||||
}
|
||||
|
||||
async function enqueueImNotifications(tx, params) {
|
||||
const {
|
||||
config,
|
||||
@@ -154,6 +180,14 @@ async function enqueueImNotifications(tx, params) {
|
||||
|
||||
let queued = 0;
|
||||
let duplicated = 0;
|
||||
const redactedMessage = redactImMessage(config, {
|
||||
title,
|
||||
body,
|
||||
targetType,
|
||||
targetId,
|
||||
entityType,
|
||||
entityId,
|
||||
});
|
||||
for (const channel of matchedChannels) {
|
||||
const result = await enqueueIntegrationEvent(tx, {
|
||||
eventType: 'notification.im',
|
||||
@@ -171,8 +205,8 @@ async function enqueueImNotifications(tx, params) {
|
||||
channelType: normalizeChannelType(channel.channel_type),
|
||||
notificationType,
|
||||
domainScope,
|
||||
title: String(title ?? '').slice(0, 200),
|
||||
body: body == null ? '' : String(body).slice(0, 4000),
|
||||
title: redactedMessage.title,
|
||||
body: redactedMessage.body,
|
||||
targetType: targetType ?? null,
|
||||
targetId: targetId ?? null,
|
||||
targetPath: targetPath ?? null,
|
||||
|
||||
在新工单中引用
屏蔽一个用户