fix(upstreams): accounts=None 保留顶层 accounts 字段(不再清空) (1.0.26)

`accounts = None` 走 legacy auth 路径时**写空 vec 覆盖**了 existing.accounts,
导致管理台 toggle「停用/启用」(只发 {slot, enabled})会把账号清单
全部清空——用户现场踩坑:minimax 2 个账号点停用变 0 个。

修:`accounts = None` 时保留 `existing.accounts`(含 note/resets),
与 base/models/note 字段的 None = 保留原值语义对齐。

回归 228/0 全绿。
This commit is contained in:
admin committed 2026-09-15 15:30:35 +08:00
1 parent bbe54f109b
commit 24ced30d41
1 file changed
+9 -1
+9 -1
View File
@@ -764,7 +764,15 @@ pub fn upsert(
(merged, String::new())
}
None => (
Vec::new(),
// accounts = None = 保留原 accounts 字段(与 base/models/note 语义一致)。
// 1.0.25 修:之前写空 vec,toggle「停用/启用」会把账号清单清空。
// 注意:existing.accounts(顶层字段)保存的是账号的 note/resets,
// auth 在 effective_accounts() 时合并 auth 与 accounts[*].auth。
// 完整保留 = 保留顶层 accounts(保留 note/resets)即可。
existing
.as_ref()
.map(|e| e.accounts.clone())
.unwrap_or_default(),
match auth_raw {
Some(a) => normalize_auth(a),
None => existing.as_ref().map(|e| e.auth.clone()).unwrap_or_default(),