fix(t97+t114): 庫目錄只顯示用戶同步進來的庫、拿掉兩段式登記
leo 07-28 原話:「用戶沒加上的庫,不要自作主張給它加上」/「掃進來的就是要進目錄… 加入目錄這件小事還要分兩段做?…這是在攻打用戶嗎?根本是 attack」。 - portal.ts:859 auto 段濾掉 general(系統未標庫桶,非用戶的庫) - index.html:bootstrap 不再預埋 kb 庫;移除「登記到目錄」按鈕與 auto/registered 視覺分岔 驗證(總管 grep 真相源):登記到目錄=0、kb 種子=0、general 濾在; os-split 10/10+safejson 8/8 綠;portal-admin 1 紅=console HTML 搬遷陳舊測試 (stash 基線同紅,與本案無關)。(實作=子 CC;驗證+commit=總管)
This commit is contained in:
@@ -376,12 +376,29 @@ describe('/portal/admin/libraries', () => {
|
||||
const res = await json('GET', '/portal/admin/libraries', undefined, { Authorization: 'Bearer tok-user' });
|
||||
expect(res.status).toBe(403);
|
||||
});
|
||||
|
||||
it('GET auto 庫列表過濾 general(general 是系統桶,不在用戶目錄顯示)', async () => {
|
||||
await seedAdminSession();
|
||||
mockGetRecord('rec_admin', adminValues());
|
||||
mockListByTemplate('portal_library', []);
|
||||
fetchMock
|
||||
.get(KBDB)
|
||||
.intercept({ path: (p: string) => p.startsWith('/entries/libraries'), method: 'GET' })
|
||||
.reply(200, { libraries: ['kb', 'general', 'notes'] });
|
||||
const res = await json('GET', '/portal/admin/libraries', undefined, { Authorization: 'Bearer tok-admin' });
|
||||
expect(res.status).toBe(200);
|
||||
const data = (await res.json()) as { libraries: { name: string; auto?: boolean }[] };
|
||||
const names = data.libraries.map((l) => l.name);
|
||||
expect(names).toContain('kb');
|
||||
expect(names).toContain('notes');
|
||||
expect(names).not.toContain('general');
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════ 6. /portal HTML 殼(P4 admin 頁後紅線不回退)═══════════════
|
||||
|
||||
describe('GET /portal(P4 admin 頁 HTML 殼)', () => {
|
||||
it('admin view 存在;仍零租戶字串、零 /kbdb/、零 X-Arcrun-API-Key、零 Mira', async () => {
|
||||
it('admin view 存在;仍零租戶字串、零 /kbdb/、零 X-Arcrun-API-Key、零 Mira;無 kb 種子、無登記到目錄', async () => {
|
||||
const res = await SELF.fetch('http://localhost/portal');
|
||||
expect(res.status).toBe(200);
|
||||
const html = await res.text();
|
||||
@@ -393,5 +410,11 @@ describe('GET /portal(P4 admin 頁 HTML 殼)', () => {
|
||||
expect(html).not.toContain('/kbdb/');
|
||||
expect(html).not.toContain('X-Arcrun-API-Key');
|
||||
expect(html).not.toContain('Mira');
|
||||
// t97a:bootstrap 後不再預埋 kb 庫
|
||||
expect(html).not.toContain('"name": "kb"');
|
||||
expect(html).not.toContain("name: 'kb'");
|
||||
// t114:無「登記到目錄」按鈕
|
||||
expect(html).not.toContain('lib-adopt');
|
||||
expect(html).not.toContain('登記到目錄');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user