Show WA nicknames and auto-fill group subjects in access UI (4.9.1-ops.9).

Fetch groupMetadata.subject on @mentions for group cards; render contact pushName under phone rows so admins are not staring at bare numbers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-05 17:29:43 +08:00
parent e8e58924ca
commit a169b164a8
10 changed files with 268 additions and 182 deletions

View file

@ -71,6 +71,20 @@ function contactLabel(contact) {
return `${name} · ${phone}`;
}
function nicknameForPhone(contacts, phone) {
const digits = digitsOnly(phone);
if (!digits) return '';
const hit = (contacts ?? []).find((contact) => contact.phone === digits || contact.phone === phone);
return typeof hit?.pushName === 'string' ? hit.pushName.trim() : '';
}
function NicknameHint({ contacts, phone }) {
const nickname = nicknameForPhone(contacts, phone);
return h('span', {
className: nickname ? 'dim-accessNickname' : 'dim-accessNickname dim-accessNicknameEmpty',
}, nickname || '暂无昵称(私聊/@ 后会自动补齐)');
}
function groupDisplayName(groupJid, groups) {
const title = groups?.[groupJid]?.title;
if (typeof title === 'string' && title.trim()) return title.trim();
@ -180,7 +194,8 @@ function MemberRows({
onChange: (phone) => onChange(members.map((entry, i) => (
i === index ? { ...entry, phone } : entry
))),
})),
}),
h(NicknameHint, { contacts, phone: member.phone })),
h('label', { className: 'dim-accessField dim-accessUserCommand' },
h('span', null, '命令权限'),
h('select', {
@ -233,7 +248,8 @@ function AdminPhones({
disabled: disabled || locked,
placeholder: '8613800000000',
onChange: (next) => onChange(phones.map((entry, i) => (i === index ? next : entry))),
})),
}),
locked ? null : h(NicknameHint, { contacts, phone })),
locked ? null : h('button', {
type: 'button',
className: 'dim-deliveryButton',

View file

@ -11,6 +11,7 @@ const EN = Object.freeze({
'机器人设置页签': 'Bot settings tabs',
'投递设置': 'Delivery settings',
'访问设置': 'Access settings',
"暂无昵称(私聊/@ 后会自动补齐)": "No nickname yet (filled after DM or @mention)",
"群聊 · ": "Group · ",
"。记得点保存。": ". Remember to save.",

View file

@ -483,6 +483,8 @@ const CSS = String.raw`
.dim-accessGroupHeading { min-width: 0; display: grid; gap: 2px; }
.dim-accessGroupHeading h3 { margin: 0; color: var(--dsw-alias-label-primary, #1f2329); font-size: 14px; line-height: 21px; font-weight: 650; }
.dim-accessGroupJid { color: var(--dsw-alias-label-tertiary, #8f959e); font-size: 11px; line-height: 16px; overflow-wrap: anywhere; }
.dim-accessNickname { display: block; margin-top: 4px; color: var(--dsw-alias-label-secondary, #646a73); font-size: 12px; line-height: 18px; font-weight: 560; }
.dim-accessNicknameEmpty { color: var(--dsw-alias-label-tertiary, #8f959e); font-weight: 400; }
.dim-accessUserRow { position: relative; z-index: 0; overflow: visible; }
.dim-panel .dim-botCard .dim-cardFooter { margin-top: 0; }
.dim-panel .ddt-headingCopy { display: none; }