mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-10 18:03:18 +08:00
feat(feishu): /archived on|off toggle for archived sessions in lists
The session list (and the numeric /watch index) honors a per-bot persisted policy: /archived off hides archived sessions from cards and index resolution, /archived on restores them. Defaults to on.
This commit is contained in:
parent
5055ffe6c8
commit
961dd5503d
4 changed files with 203 additions and 112 deletions
|
|
@ -2543,3 +2543,46 @@ test('reconnect compensation replays missed turn/end and dedups duplicates', asy
|
|||
assert.equal(cards.length, 2, 'exactly one new completion from compensation (t1 deduped)');
|
||||
assert.match(JSON.stringify(cards[1]), /watched-session/);
|
||||
});
|
||||
|
||||
test('/archived off hides archived sessions from the list and watch index', async () => {
|
||||
const { state } = await watchStoreFixture();
|
||||
const work = join(tmpdir(), 'dsh-im-archived-test-work');
|
||||
mkdirSync(work, { recursive: true });
|
||||
const harness = watchHarness({
|
||||
current: work,
|
||||
sessionsByWorkspace: {
|
||||
[work]: [
|
||||
{ sessionId: 'live-session', title: 'Live', archived: false },
|
||||
{ sessionId: 'old-session', title: 'Old', archived: true },
|
||||
],
|
||||
},
|
||||
});
|
||||
const sent = [];
|
||||
const cards = [];
|
||||
const bridge = new FeishuHarnessBridge({
|
||||
client: cardClient(async ({ msgType, content }) => {
|
||||
if (msgType === 'interactive') cards.push(content);
|
||||
}),
|
||||
channel: {},
|
||||
harness,
|
||||
state,
|
||||
status: bridgeStatus(),
|
||||
allowedSenderOpenIds: new Set(['ou_owner']),
|
||||
});
|
||||
bridge._sent = sent;
|
||||
|
||||
await bridge.accept(event('archived-off', '/archived off', { senderOpenId: 'ou_owner' }));
|
||||
await bridge.waitForIdle();
|
||||
assert.equal(state.includesArchivedSessions(), false);
|
||||
|
||||
await bridge.accept(event('sessions-arch', '/sessionlist', { senderOpenId: 'ou_owner' }));
|
||||
await bridge.waitForIdle();
|
||||
const use = useActionsFromCard(cards.at(-1));
|
||||
assert.deepEqual(use, ['live-session'], 'archived session hidden');
|
||||
|
||||
// The numeric watch index must resolve against the filtered list too.
|
||||
await bridge.accept(event('watch-arch', '/watch 1', { senderOpenId: 'ou_owner' }));
|
||||
await bridge.waitForIdle();
|
||||
assert.ok(state.watchEntry('p2p:ou_owner', 'live-session'));
|
||||
assert.equal(state.watchEntry('p2p:ou_owner', 'old-session'), null);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue