mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 00:33:20 +08:00
Fix access-grant phone inputs losing focus after each keystroke.
Row keys included the phone value, so each character remounted the input; also sync draft from serialized grant content, not object identity. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
9f97c44031
commit
a0c49707a1
4 changed files with 11 additions and 9 deletions
|
|
@ -571,7 +571,7 @@ var React24 = __toESM(require("react"), 1);
|
|||
// package.json
|
||||
var package_default = {
|
||||
name: "dsh-im-ops",
|
||||
version: "4.9.1-ops.4",
|
||||
version: "4.9.1-ops.5",
|
||||
description: "Ops fork of dsh-im (all channels kept). Based on @xmanrui/dsh-im@4.9.1 \u2014 access/session policies owned here.",
|
||||
keywords: [
|
||||
"deepseek-harness",
|
||||
|
|
@ -12624,7 +12624,7 @@ function MemberRows({
|
|||
h2("legend", null, title),
|
||||
h2("ul", { className: "dim-accessUserList" }, members.map((member, index) => h2(
|
||||
"li",
|
||||
{ key: `${member.phone}-${index}`, className: "dim-accessUserRow" },
|
||||
{ key: `member-${index}`, className: "dim-accessUserRow" },
|
||||
h2(
|
||||
"label",
|
||||
{ className: "dim-accessField dim-accessUserId" },
|
||||
|
|
@ -12683,7 +12683,7 @@ function AdminPhones({
|
|||
const locked = lockedPhone && phone === lockedPhone;
|
||||
return h2(
|
||||
"li",
|
||||
{ key: `${phone}-${index}`, className: "dim-accessUserRow" },
|
||||
{ key: `admin-${index}`, className: "dim-accessUserRow" },
|
||||
h2(
|
||||
"label",
|
||||
{ className: "dim-accessField dim-accessUserId" },
|
||||
|
|
@ -12721,6 +12721,7 @@ function AccessGrantSettingsPage({ channel: channel4, account, rpcCall, onSaved
|
|||
}
|
||||
const ownerPhone = ownerPhoneFromAccount(account);
|
||||
const initialGrant = normalizeAccessGrant(account?.accessGrant);
|
||||
const initialKey = JSON.stringify(initialGrant);
|
||||
const initialScope = normalizeGroupSessionScope(account?.groupSessionScope);
|
||||
const [draft, setDraft] = React21.useState(() => cloneGrant(initialGrant, ownerPhone));
|
||||
const [groupSessionScope, setGroupSessionScope] = React21.useState(initialScope);
|
||||
|
|
@ -12730,7 +12731,7 @@ function AccessGrantSettingsPage({ channel: channel4, account, rpcCall, onSaved
|
|||
React21.useEffect(() => {
|
||||
setDraft(cloneGrant(normalizeAccessGrant(account?.accessGrant), ownerPhone));
|
||||
setGroupSessionScope(normalizeGroupSessionScope(account?.groupSessionScope));
|
||||
}, [account?.botId, account?.accessGrant, account?.groupSessionScope, ownerPhone]);
|
||||
}, [account?.botId, initialKey, account?.groupSessionScope, ownerPhone]);
|
||||
const contacts = draft.contacts ?? [];
|
||||
const knownGroupJids = React21.useMemo(() => {
|
||||
const set = new Set(Object.keys(draft.groups ?? {}));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dsh-im-ops",
|
||||
"version": "4.9.1-ops.4",
|
||||
"version": "4.9.1-ops.5",
|
||||
"description": "Ops fork of dsh-im (all channels kept). Based on @xmanrui/dsh-im@4.9.1 — access/session policies owned here.",
|
||||
"keywords": [
|
||||
"deepseek-harness",
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ function MemberRows({
|
|||
return h('fieldset', { className: 'dim-accessScene', disabled },
|
||||
h('legend', null, title),
|
||||
h('ul', { className: 'dim-accessUserList' }, members.map((member, index) =>
|
||||
h('li', { key: `${member.phone}-${index}`, className: 'dim-accessUserRow' },
|
||||
h('li', { key: `member-${index}`, className: 'dim-accessUserRow' },
|
||||
h('label', { className: 'dim-accessField dim-accessUserId' },
|
||||
h('span', null, '电话'),
|
||||
h(PhoneTypeahead, {
|
||||
|
|
@ -180,7 +180,7 @@ function AdminPhones({
|
|||
help ? h('p', { className: 'dim-accessUsersEmpty' }, help) : null,
|
||||
h('ul', { className: 'dim-accessUserList' }, phones.map((phone, index) => {
|
||||
const locked = lockedPhone && phone === lockedPhone;
|
||||
return h('li', { key: `${phone}-${index}`, className: 'dim-accessUserRow' },
|
||||
return h('li', { key: `admin-${index}`, className: 'dim-accessUserRow' },
|
||||
h('label', { className: 'dim-accessField dim-accessUserId' },
|
||||
h('span', null, locked ? '绑定账号(全局管理员)' : '电话'),
|
||||
h(PhoneTypeahead, {
|
||||
|
|
@ -214,6 +214,7 @@ export function AccessGrantSettingsPage({ channel, account, rpcCall, onSaved })
|
|||
}
|
||||
const ownerPhone = ownerPhoneFromAccount(account);
|
||||
const initialGrant = normalizeAccessGrant(account?.accessGrant);
|
||||
const initialKey = JSON.stringify(initialGrant);
|
||||
const initialScope = normalizeGroupSessionScope(account?.groupSessionScope);
|
||||
const [draft, setDraft] = React.useState(() => cloneGrant(initialGrant, ownerPhone));
|
||||
const [groupSessionScope, setGroupSessionScope] = React.useState(initialScope);
|
||||
|
|
@ -224,7 +225,7 @@ export function AccessGrantSettingsPage({ channel, account, rpcCall, onSaved })
|
|||
React.useEffect(() => {
|
||||
setDraft(cloneGrant(normalizeAccessGrant(account?.accessGrant), ownerPhone));
|
||||
setGroupSessionScope(normalizeGroupSessionScope(account?.groupSessionScope));
|
||||
}, [account?.botId, account?.accessGrant, account?.groupSessionScope, ownerPhone]);
|
||||
}, [account?.botId, initialKey, account?.groupSessionScope, ownerPhone]);
|
||||
|
||||
const contacts = draft.contacts ?? [];
|
||||
const knownGroupJids = React.useMemo(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue