Hide pinned controls on Web conversations

This commit is contained in:
kris
2026-04-11 02:44:01 +08:00
parent 164a7568a7
commit 5bf745f45f
2 changed files with 38 additions and 10 deletions

View File

@@ -15,6 +15,7 @@ let formatTimestampLabel: (typeof import("../src/lib/boss-projections"))["format
let getConversationListItemPresentation: (typeof import("../src/components/app-ui"))["getConversationListItemPresentation"];
let getConversationActionAvailability: (typeof import("../src/components/app-ui"))["getConversationActionAvailability"];
let getConversationActionsPath: (typeof import("../src/components/app-ui"))["getConversationActionsPath"];
let getConversationPinnedBadgeLabel: (typeof import("../src/components/app-ui"))["getConversationPinnedBadgeLabel"];
async function setup() {
if (runtimeRoot) return;
@@ -37,6 +38,7 @@ async function setup() {
getConversationListItemPresentation = ui.getConversationListItemPresentation;
getConversationActionAvailability = ui.getConversationActionAvailability;
getConversationActionsPath = ui.getConversationActionsPath;
getConversationPinnedBadgeLabel = ui.getConversationPinnedBadgeLabel;
}
test.after(async () => {
@@ -705,7 +707,7 @@ test("conversation home compacts imported previews and trims local workspace pre
assert.equal(item?.lastMessagePreview, "已导入线程");
});
test("folder archive homepage rows expose pin toggles when the folder is pinned", async () => {
test("folder archive homepage rows do not expose pin toggles in the Web surface", async () => {
await setup();
const state = await readState();
@@ -738,8 +740,34 @@ test("folder archive homepage rows expose pin toggles when the folder is pinned"
assert.ok(folder, "expected grouped folder archive item");
const actions = getConversationActionAvailability(folder!);
assert.equal(actions.canTogglePin, true);
assert.equal(actions.togglePinLabel, "取消置顶");
assert.equal(actions.canTogglePin, false);
});
test("homepage rows do not expose pinned labels in the Web surface", async () => {
await setup();
const state = await readState();
state.projects = state.projects.filter((project) => project.id === "master-agent");
state.projects.push({
...buildImportedThreadProject(
"mac-studio",
"boss-thread-1",
"Boss",
"boss",
"归档确认",
"thread-1",
"2026-03-30T11:00:00+08:00",
),
pinned: true,
});
const pinnedThread = getConversationHomeItems(state).find((item) => item.projectId === "boss-thread-1");
assert.ok(pinnedThread, "expected pinned thread item");
assert.equal(getConversationPinnedBadgeLabel(pinnedThread!), "");
const masterAgent = getConversationHomeItems(state).find((item) => item.projectId === "master-agent");
assert.ok(masterAgent, "expected master agent item");
assert.equal(getConversationPinnedBadgeLabel(masterAgent!), "");
});
test("folder archive action path encodes folder keys with nested path segments", async () => {