修复第2章复测发现的3个问题:好友申请通知按钮/时间格式/新机器码样本
- 好友申请通知的"查看新朋友"按钮永远不出现:判断条件是 action.type==='friend_request',
但实测 GET /system-notifications 拿到的 friend.request.created 通知,action 里只有
{user_id},从来没有 type 字段——这个判断条件是当初凭对接文档猜的,不是照真实响应写的。
改用 event_type.startsWith('friend.request')。
- 系统消息时间格式:默认 toLocaleString('zh-CN') 输出"2026/8/20 18:04:00"(年份/斜杠/秒),
参考图是"6月28日 10:04"。新增 formatNotificationTime。
- 机器码兜底表补一条:新样本 security.risk.continue 事件的 summary 是 decision 字面量
"continue",同样会被机器码识别但查表落空、原样显示英文单词。
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
02a565b8e5
commit
8e703d86eb
+10
-3
@@ -12792,6 +12792,12 @@ function formatConversationTime(ts) {
|
||||
day: 'numeric'
|
||||
});
|
||||
}
|
||||
function formatNotificationTime(ts) {
|
||||
const d = new Date(ts);
|
||||
const hh = String(d.getHours()).padStart(2, '0');
|
||||
const mm = String(d.getMinutes()).padStart(2, '0');
|
||||
return `${d.getMonth() + 1}月${d.getDate()}日 ${hh}:${mm}`;
|
||||
}
|
||||
function entryConversations(bootstrap) {
|
||||
if (!bootstrap || !bootstrap.entries) return [];
|
||||
const list = [];
|
||||
@@ -13158,7 +13164,8 @@ const NOTIFICATION_TEXT = {
|
||||
'group.role.updated': '群成员角色有变更',
|
||||
'group.settings.updated': '群设置有更新',
|
||||
accepted: '对方已通过你的好友申请',
|
||||
rejected: '对方拒绝了你的好友申请'
|
||||
rejected: '对方拒绝了你的好友申请',
|
||||
continue: '你确认继续了一次安全风险提示'
|
||||
};
|
||||
function systemNotificationText(item) {
|
||||
const summary = (item.summary || '').trim();
|
||||
@@ -13225,7 +13232,7 @@ function SystemMessages({
|
||||
className: item.read_at ? 'read' : '',
|
||||
onClick: () => markRead(item),
|
||||
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxDEV)("time", {
|
||||
children: new Date(item.created_at).toLocaleString('zh-CN')
|
||||
children: formatNotificationTime(item.created_at)
|
||||
}, void 0, false), (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxDEV)("div", {
|
||||
className: "system-notification-card",
|
||||
children: [(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxDEV)("header", {
|
||||
@@ -13260,7 +13267,7 @@ function SystemMessages({
|
||||
children: ["查看群聊 ", (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxDEV)(Icon, {
|
||||
children: "chevron_right"
|
||||
}, void 0, false)]
|
||||
}, void 0, true) : item.action && item.action.type === 'friend_request' ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxDEV)("button", {
|
||||
}, void 0, true) : item.event_type && item.event_type.startsWith('friend.request') ? (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxDEV)("button", {
|
||||
type: "button",
|
||||
className: "system-security-link",
|
||||
onClick: e => {
|
||||
|
||||
Reference in New Issue
Block a user