Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(group-chat): 话题贴回入口复用群房间校验

Dash7bd62a33517b
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
index ae02296f05..f88eac8534 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
@@ -1961,7 +1961,7 @@ describe('Chat Server result delivery and refresh', () => {
expect(await service.getGroup(other)).toMatchObject({ ok: false, errorCode: 'NOT_FOUND' });
});
- it.each([directId, channelId, futureId])('rejects dissolution and reactor reads for %s without subscriptions or other room access', async groupId => {
+ it.each([directId, channelId, futureId])('rejects dissolution, reactor reads and thread shares for %s without subscriptions or other room access', async groupId => {
await service.listGroups();
await vi.advanceTimersByTimeAsync(2000);
const socket = fixture.sockets[0];
@@ -1974,6 +1974,8 @@ describe('Chat Server result delivery and refresh', () => {
.toMatchObject({ ok: false, errorCode: 'CONVERSATION_NOT_FOUND' });
expect(await service.chatServer!.reactors({ groupId, messageId: roomId, emoji: '👍' }))
.toMatchObject({ ok: false, errorCode: 'CONVERSATION_NOT_FOUND' });
+ expect(await service.chatServer!.shareToMain({ groupId, messageId: roomId }))
+ .toMatchObject({ ok: false, errorCode: 'CONVERSATION_NOT_FOUND' });
expect(fixture.handle.mock.calls.filter(([route]) => String(route).startsWith(`/conversations/${groupId}`) && !String(route).endsWith('/snapshot'))).toEqual([]);
expect(vi.mocked(socket.send).mock.calls.filter(([raw]) => String(raw).includes(groupId))).toEqual([]);
});
diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.ts
index 627fc6b1da..a4118e9def 100644
--- a/apps/desktop/src/main/maker-ipc/chatServer.ts
+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts
@@ -1541,7 +1541,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD
}),
shareToMain: input => result(async () => {
const i = z.object({ groupId: id, messageId: id }).strict().parse(input);
- const room = await resolveGroup(i.groupId);
+ const room = await groupRoom(i.groupId);
const source = await readMessage(room, i.messageId);
if (!source || !isShareableThreadReply(source)) throw new Error('SHARE_UNAVAILABLE');
const members = await api<Member[]>(`/conversations/${room}/members`);