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(bots): 只有验证通过的贴回才显示查看话题

Dash66e6e70b4cc6
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupThreadViews.tsx b/apps/desktop/src/renderer/features/bots/BotGroupThreadViews.tsx
index 247e4f54dc..a82b043418 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupThreadViews.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupThreadViews.tsx
@@ -138,7 +138,8 @@ export function BotGroupThreadShareQuote({ share, members, attachments, onOpenTh
{t(key(share.status === 'loading' ? 'loadingSource' : 'sourceUnavailable'))}
</p>
)}
- {onOpenThread ? <button type="button" onClick={onOpenThread}
+ {/* Only a verified share leads anywhere: the card's own thread ID is not trusted. */}
+ {onOpenThread && available ? <button type="button" onClick={onOpenThread}
className={cn('-ml-1.5 inline-flex min-h-6 w-fit select-none items-center gap-1 rounded-full px-1.5 text-12 text-[var(--text-secondary)] transition-colors duration-[var(--motion-fast)] hover:bg-[var(--surface-hover)] hover:text-[var(--text-primary)]', FOCUS)}>
<CornerDownRight size={12} aria-hidden />
{t(key('viewThread'))}
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
index 0235b5d71b..cd4327e86e 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
@@ -2194,6 +2194,9 @@ describe('thread previews and posting to the main chat', () => {
const own = screen.getByText(t('alsoSent')).closest('article')!;
expect(within(own).getByText('我自己的回复')).toBeTruthy();
expect(screen.getByText(t('sourceUnavailable'))).toBeTruthy();
+ // An unverified card's own thread ID leads nowhere.
+ const gone = screen.getByText(t('sourceUnavailable')).closest('article')!;
+ expect(within(gone).queryByRole('button', { name: t('viewThread') })).toBeNull();
await user.click(within(other).getByRole('button', { name: t('viewThread') }));
const panel = await screen.findByRole('complementary');
await waitFor(() => expect(within(panel).getByText('Reply to u1').closest('article')!.className).toContain('ring-2'));