Sync WhatsApp group subjects into access UI (4.9.1-ops.10).

Refresh missing/forced group titles via groupMetadata and participating catalog so cards show real names instead of bare JIDs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-05 17:39:25 +08:00
parent a169b164a8
commit f96157da1e
13 changed files with 568 additions and 260 deletions

View file

@ -2,6 +2,7 @@ import { validateAccessGrant, normalizeAccessGrant } from '../../../../src/chann
export const SET_ACCESS_GRANT_ENDPOINT = 'bot.access-grant.set';
export const RESOLVE_ACCESS_PENDING_ENDPOINT = 'bot.access-pending.resolve';
export const REFRESH_ACCESS_GROUP_TITLES_ENDPOINT = 'bot.access-group-titles.refresh';
export function validAccessGrantPayload(payload) {
try {
@ -41,6 +42,21 @@ export function validAccessPendingResolvePayload(payload) {
}
}
export function validAccessGroupTitlesRefreshPayload(payload) {
try {
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) return false;
if (!Object.hasOwn(payload, 'botId') || typeof payload.botId !== 'string'
|| !/^[A-Za-z0-9_-]{1,128}$/.test(payload.botId)) return false;
const keys = Reflect.ownKeys(payload);
if (keys.length === 1) return true;
if (keys.length !== 2 || !Object.hasOwn(payload, 'groupJids')) return false;
if (!Array.isArray(payload.groupJids)) return false;
return payload.groupJids.every((jid) => typeof jid === 'string' && /^\d{5,32}@g\.us$/.test(jid));
} catch {
return false;
}
}
export function publicAccessGrant(grant) {
const normalized = normalizeAccessGrant(grant);
if (!normalized) return null;