🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(channel): notify members mentioned in a Channel message (#22222)
AmAzing-675355797d30
diff --git a/apps/server/src/services/channel/ChannelService.routing.test.ts b/apps/server/src/services/channel/ChannelService.routing.test.tsindex 346b708bd30..b36a1fde39c 100644--- a/apps/server/src/services/channel/ChannelService.routing.test.ts+++ b/apps/server/src/services/channel/ChannelService.routing.test.ts@@ -9,6 +9,7 @@ const mocks = vi.hoisted(() => ({retry: vi.fn(),wake: vi.fn(),notify: vi.fn(),+ notifyMentions: vi.fn(),}));vi.mock('@/database/repositories/channel', () => ({ChannelRepository: class {@@ -21,6 +22,7 @@ vi.mock('@/database/models/device', () => ({ DeviceModel: class {} }));vi.mock('@/server/services/agent', () => ({ AgentService: class {} }));vi.mock('@/server/services/file', () => ({ FileService: class {} }));vi.mock('./ChannelCoordinator', () => ({ ChannelCoordinator: class {} }));+vi.mock('./mention', () => ({ notifyChannelMentions: mocks.notifyMentions }));vi.mock('./notify', () => ({ notifyChannel: mocks.notify }));vi.mock('./queue', () => ({ wakeChannel: mocks.wake }));vi.mock('./routingConfig', () => ({ resolveChannelRoutingConfig: mocks.config }));diff --git a/apps/server/src/services/channel/ChannelService.test.ts b/apps/server/src/services/channel/ChannelService.test.tsindex d7c46ad6d6a..e4b989d85c8 100644--- a/apps/server/src/services/channel/ChannelService.test.ts+++ b/apps/server/src/services/channel/ChannelService.test.ts@@ -3,13 +3,14 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import { ChannelService } from './ChannelService';-const { remove, removeThread, wake, notify, send, routing } = vi.hoisted(() => ({+const { remove, removeThread, wake, notify, notifyMentions, send, routing } = vi.hoisted(() => ({remove: vi.fn(),send: vi.fn(),routing: vi.fn(),removeThread: vi.fn(),wake: vi.fn(),notify: vi.fn(),+ notifyMentions: vi.fn(),}));vi.mock('@/database/repositories/channel', async (original) => ({...(await original<object>()),@@ -23,6 +24,7 @@ vi.mock('@/database/models/device', () => ({ DeviceModel: class {} }));vi.mock('@/server/services/agent', () => ({ AgentService: class {} }));vi.mock('@/server/services/file', () => ({ FileService: class {} }));vi.mock('./ChannelCoordinator', () => ({ ChannelCoordinator: class {} }));+vi.mock('./mention', () => ({ notifyChannelMentions: notifyMentions }));vi.mock('./notify', () => ({ notifyChannel: notify }));vi.mock('./routingConfig', () => ({ resolveChannelRoutingConfig: routing }));vi.mock('./queue', () => ({ wakeChannel: wake }));@@ -95,4 +97,16 @@ describe('Channel reply dispatch', () => {expect(wake).toHaveBeenCalledTimes(2);expect(send).toHaveBeenNthCalledWith(2, 'channel', { ...input, routing: 'fallback' });});++ it('pings mentioned people once the message is stored, even when scheduling Agents fails', async () => {+ const message = { id: 'message', mentions: ['member'], routingStatus: 'directed' };+ send.mockResolvedValue(message);+ wake.mockRejectedValueOnce(new Error('queue unavailable'));+ await expect(service().send('channel', input)).rejects.toThrow('queue unavailable');+ expect(notifyMentions).toHaveBeenCalledWith(+ expect.anything(),+ { userId: 'owner', workspaceId: 'workspace' },+ message,+ );+ });});diff --git a/apps/server/src/services/channel/ChannelService.ts b/apps/server/src/services/channel/ChannelService.tsindex 906ec49b761..ccbfd4b743d 100644--- a/apps/server/src/services/channel/ChannelService.ts+++ b/apps/server/src/services/channel/ChannelService.ts@@ -23,6 +23,7 @@ import { deviceGateway } from '@/server/services/deviceGateway';import { FileService } from '@/server/services/file';import { ChannelCoordinator } from './ChannelCoordinator';+import { notifyChannelMentions } from './mention';import { notifyChannel } from './notify';import { wakeChannel } from './queue';import { resolveChannelRoutingConfig } from './routingConfig';@@ -336,6 +337,7 @@ export class ChannelService {...input,routing: config ? 'decision' : 'fallback',});+ notifyChannelMentions(this.db, { userId: this.userId, workspaceId: this.workspaceId }, message);// Human quotes only update the public feed; they never schedule Agent work.if (message.replyToId && message.routingStatus === 'skipped') await this.changed(channelId);else await Promise.all([wakeChannel(channelId), this.changed(channelId)]);diff --git a/apps/server/src/services/channel/mention.db.test.ts b/apps/server/src/services/channel/mention.db.test.tsnew file mode 100644index 00000000000..ed0d22c852f--- /dev/null+++ b/apps/server/src/services/channel/mention.db.test.ts@@ -0,0 +1,92 @@+// @vitest-environment node+import { getTestDB } from '@lobechat/database/test-utils';+import { and, eq } from 'drizzle-orm';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { ChannelRepository } from '@/database/repositories/channel';+import { createChannelFixture } from '@/database/repositories/channel/__tests__/testUtils';+import { workspaceMembers } from '@/database/schemas';++import { notifyChannelMentions } from './mention';++const { after, notifyChannelMention } = vi.hoisted(() => ({+ after: vi.fn(),+ notifyChannelMention: vi.fn(),+}));+vi.mock('@/server/utils/scheduleAfterResponse', () => ({ after }));+vi.mock('@/business/server/channel-mention/notifyActivity', () => ({ notifyChannelMention }));++const db = await getTestDB();+const fixture = createChannelFixture(db, 'channel-mention-notify');+beforeEach(async () => {+ vi.resetAllMocks();+ await fixture.setup();+ await db.insert(workspaceMembers).values([+ { role: 'owner', userId: fixture.ownerId, workspaceId: fixture.workspaceId },+ { userId: fixture.memberId, workspaceId: fixture.workspaceId },+ ]);+});+afterEach(fixture.cleanup);++/** The owner mentions themself and the member in a workspace Channel, then the ping runs. */+const mentionMember = async () => {+ const owner = new ChannelRepository(db, fixture.ownerId, fixture.workspaceId);+ const { channel } = await owner.create({ title: 'People' });+ const member = await owner.addUser(channel.id, fixture.memberId);+ const ownerMember = (await owner.detail(channel.id)).members.find(+ (item) => item.userId === fixture.ownerId,+ );+ const message = await owner.send(channel.id, {+ content: '@Olivia @mia please review',+ mentions: [ownerMember!.id, member.id],+ requestKey: 'mention',+ routing: 'fallback',+ });+ notifyChannelMentions(db, { userId: fixture.ownerId, workspaceId: fixture.workspaceId }, message);+ await after.mock.calls[0][0]();+ return { channel, message };+};++describe('notifyChannelMentions against the database', () => {+ it('pings the mentioned workspace member, never the sender', async () => {+ const { channel, message } = await mentionMember();++ expect(notifyChannelMention).toHaveBeenCalledWith({+ actorUserId: fixture.ownerId,+ channelId: channel.id,+ messageId: message.id,+ recipientUserIds: [fixture.memberId],+ workspaceId: fixture.workspaceId,+ });+ });++ it('skips a person who left the workspace but still has a Channel member row', async () => {+ const owner = new ChannelRepository(db, fixture.ownerId, fixture.workspaceId);+ const { channel } = await owner.create({ title: 'People' });+ const member = await owner.addUser(channel.id, fixture.memberId);+ // Leaving the workspace soft-deletes its membership and keeps the Channel row active.+ await db+ .update(workspaceMembers)+ .set({ deletedAt: new Date() })+ .where(+ and(+ eq(workspaceMembers.workspaceId, fixture.workspaceId),+ eq(workspaceMembers.userId, fixture.memberId),+ ),+ );+ const message = await owner.send(channel.id, {+ content: '@mia are you still here?',+ mentions: [member.id],+ requestKey: 'departed',+ routing: 'fallback',+ });+ notifyChannelMentions(+ db,+ { userId: fixture.ownerId, workspaceId: fixture.workspaceId },+ message,+ );+ await after.mock.calls[0][0]();++ expect(notifyChannelMention).not.toHaveBeenCalled();+ });+});diff --git a/apps/server/src/services/channel/mention.test.ts b/apps/server/src/services/channel/mention.test.tsnew file mode 100644index 00000000000..7ddcd1b4cfb--- /dev/null+++ b/apps/server/src/services/channel/mention.test.ts@@ -0,0 +1,77 @@+// @vitest-environment node+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { notifyChannelMentions } from './mention';++const { after, notifyChannelMention } = vi.hoisted(() => ({+ after: vi.fn(),+ notifyChannelMention: vi.fn(),+}));+vi.mock('@/server/utils/scheduleAfterResponse', () => ({ after }));+vi.mock('@/business/server/channel-mention/notifyActivity', () => ({ notifyChannelMention }));++const dbReturning = (rows: { userId: string | null }[]) => {+ const where = vi.fn().mockResolvedValue(rows);+ const query = { innerJoin: () => query, where };+ return { db: { select: () => ({ from: () => query }) } as never, where };+};++const runScheduled = async () => {+ expect(after).toHaveBeenCalledTimes(1);+ await after.mock.calls[0][0]();+};++const message = { channelId: 'channel', id: 'message', mentions: ['member-a', 'member-b'] };++describe('notifyChannelMentions', () => {+ beforeEach(() => vi.resetAllMocks());++ it('notifies the mentioned people other than the sender after the response', async () => {+ const { db } = dbReturning([+ { userId: 'sender' },+ { userId: 'teammate' },+ { userId: 'teammate' },+ { userId: null },+ ]);++ notifyChannelMentions(db, { userId: 'sender', workspaceId: 'workspace' }, message);+ expect(notifyChannelMention).not.toHaveBeenCalled();+ await runScheduled();++ expect(notifyChannelMention).toHaveBeenCalledWith({+ actorUserId: 'sender',+ channelId: 'channel',+ messageId: 'message',+ recipientUserIds: ['teammate'],+ workspaceId: 'workspace',+ });+ });++ it('skips personal Channels and messages without mentions', () => {+ const { db } = dbReturning([{ userId: 'teammate' }]);+ notifyChannelMentions(db, { userId: 'sender' }, message);+ notifyChannelMentions(+ db,+ { userId: 'sender', workspaceId: 'workspace' },+ { ...message, mentions: [] },+ );+ expect(after).not.toHaveBeenCalled();+ });++ it('stays silent when only Agents or the sender were mentioned', async () => {+ const { db } = dbReturning([{ userId: 'sender' }]);+ notifyChannelMentions(db, { userId: 'sender', workspaceId: 'workspace' }, message);+ await runScheduled();+ expect(notifyChannelMention).not.toHaveBeenCalled();+ });++ it('never surfaces a lookup failure', async () => {+ const { db, where } = dbReturning([]);+ where.mockRejectedValue(new Error('db unavailable'));+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});+ notifyChannelMentions(db, { userId: 'sender', workspaceId: 'workspace' }, message);+ await expect(runScheduled()).resolves.toBeUndefined();+ expect(notifyChannelMention).not.toHaveBeenCalled();+ expect(error).toHaveBeenCalled();+ });+});diff --git a/apps/server/src/services/channel/mention.ts b/apps/server/src/services/channel/mention.tsnew file mode 100644index 00000000000..6b5d2f43f46--- /dev/null+++ b/apps/server/src/services/channel/mention.ts@@ -0,0 +1,70 @@+import type { LobeChatDatabase } from '@lobechat/database';+import { and, eq, inArray, isNull } from 'drizzle-orm';++import { notifyChannelMention } from '@/business/server/channel-mention/notifyActivity';+import { channelMembers, workspaceMembers } from '@/database/schemas';+import { after } from '@/server/utils/scheduleAfterResponse';++interface MentionedMessage {+ channelId: string;+ id: string;+ mentions: string[];+}++/**+ * Ping the people a workspace Channel message @-mentions. Runs after the response and never+ * fails the send; a retried send returns the same message, so its notification dedupes. The+ * business slot is a no-op outside Cloud.+ */+export const notifyChannelMentions = (+ db: LobeChatDatabase,+ context: { userId: string; workspaceId?: string },+ message: MentionedMessage,+) => {+ const { userId, workspaceId } = context;+ if (!workspaceId || !message.mentions.length) return;++ after(async () => {+ try {+ const members = await db+ .select({ userId: channelMembers.userId })+ .from(channelMembers)+ // Leaving a workspace keeps the Channel member row, so membership is checked here.+ .innerJoin(+ workspaceMembers,+ and(+ eq(workspaceMembers.userId, channelMembers.userId),+ eq(workspaceMembers.workspaceId, workspaceId),+ isNull(workspaceMembers.deletedAt),+ ),+ )+ .where(+ and(+ eq(channelMembers.channelId, message.channelId),+ inArray(channelMembers.id, message.mentions),+ eq(channelMembers.actorType, 'user'),+ eq(channelMembers.status, 'active'),+ ),+ );+ const recipientUserIds = [+ ...new Set(members.flatMap((member) => (member.userId ? [member.userId] : []))),+ ].filter((id) => id !== userId);+ if (!recipientUserIds.length) return;++ await notifyChannelMention({+ actorUserId: userId,+ channelId: message.channelId,+ messageId: message.id,+ recipientUserIds,+ workspaceId,+ });+ } catch (error) {+ console.error('[channel] Failed to send mention notification', {+ channelId: message.channelId,+ error,+ messageId: message.id,+ workspaceId,+ });+ }+ });+};diff --git a/locales/en-US/notification.json b/locales/en-US/notification.jsonindex 4c1a3688893..3f6f84e5e8b 100644--- a/locales/en-US/notification.json+++ b/locales/en-US/notification.json@@ -38,6 +38,8 @@"category.schedule": "Scheduled tasks","category.system": "System notifications","category.workspace": "Workspace updates",+ "channel_mentioned": "{{actorLabel}} mentioned you in the channel \"{{channelTitle}}\".",+ "channel_mentioned_title": "You were mentioned in a channel","checkout_abandoned_subscription": "You started upgrading to {{plan}} but did not finish checkout. Your upgrade is still available whenever you are ready.","checkout_abandoned_subscription_action": "Finish upgrade","checkout_abandoned_subscription_title": "Your upgrade is unfinished",diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex ef2b80041f5..371238a3e7b 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -1133,6 +1133,7 @@"notification.item.agent_run_completed": "Agent task completed","notification.item.agent_task_run_failed": "Task failed","notification.item.agent_transfer_result": "Transfer request result",+ "notification.item.channel_mentioned": "Mentioned in a channel","notification.item.checkout_abandoned": "Unfinished checkout reminders","notification.item.credit_balance_low": "Balance running low","notification.item.image_generation_completed": "Image generation completed",diff --git a/locales/zh-CN/notification.json b/locales/zh-CN/notification.jsonindex ed917f617b4..8c5c0a481c5 100644--- a/locales/zh-CN/notification.json+++ b/locales/zh-CN/notification.json@@ -38,6 +38,8 @@"category.schedule": "定时任务","category.system": "系统消息","category.workspace": "工作区动态",+ "channel_mentioned": "{{actorLabel}} 在频道「{{channelTitle}}」中提到了你。",+ "channel_mentioned_title": "你在频道中被提及","checkout_abandoned_subscription": "您开始升级到 {{plan}},但还没有完成付款。随时可以回来继续升级。","checkout_abandoned_subscription_action": "继续升级","checkout_abandoned_subscription_title": "升级尚未完成",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex cf13a61158d..b1a9cb24cb3 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -1133,6 +1133,7 @@"notification.item.agent_run_completed": "Agent 任务完成","notification.item.agent_task_run_failed": "任务失败","notification.item.agent_transfer_result": "转移请求结果",+ "notification.item.channel_mentioned": "频道中被提及","notification.item.checkout_abandoned": "未完成付款提醒","notification.item.credit_balance_low": "余额即将用尽","notification.item.image_generation_completed": "图片生成完成",diff --git a/packages/const/src/url.test.ts b/packages/const/src/url.test.tsindex bd19b268a65..af689740c46 100644--- a/packages/const/src/url.test.ts+++ b/packages/const/src/url.test.ts@@ -1,6 +1,13 @@import { describe, expect, it } from 'vitest';-import { FEEDBACK, GITHUB, GITHUB_ISSUES, isOfficialCloudServer, RELEASES_URL } from './url';+import {+ CHANNEL_URL,+ FEEDBACK,+ GITHUB,+ GITHUB_ISSUES,+ isOfficialCloudServer,+ RELEASES_URL,+} from './url';describe('isOfficialCloudServer', () => {it.each([@@ -33,3 +40,17 @@ describe('GitHub links', () => {expect(RELEASES_URL).toBe('https://github.com/lobehub/lobehub/releases');});});++describe('CHANNEL_URL', () => {+ it('builds the channel and thread paths', () => {+ expect(CHANNEL_URL('chn_1')).toBe('/channels/chn_1');+ expect(CHANNEL_URL('chn_1', 'cht_1')).toBe('/channels/chn_1?thread=cht_1');+ });++ it('opens a project Channel inside its project', () => {+ expect(CHANNEL_URL('chn_1', null, 'pro_1')).toBe('/project/pro_1/channels/chn_1');+ expect(CHANNEL_URL('chn_1', 'cht_1', 'pro_1')).toBe(+ '/project/pro_1/channels/chn_1?thread=cht_1',+ );+ });+});diff --git a/packages/const/src/url.ts b/packages/const/src/url.tsindex 4ac63ade950..c86fb67d9a6 100644--- a/packages/const/src/url.ts+++ b/packages/const/src/url.ts@@ -85,6 +85,19 @@ export const GROUP_CHAT_URL = (groupId: string) => `/group/${groupId}`;export const GROUP_CHAT_TOPIC_URL = (groupId: string, topicId: string) =>urlJoin('/group', groupId, topicId);+/**+ * A Channel page; a thread opens beside its Channel. A project's Channel opens inside the+ * project so its sidebar stays in place.+ */+export const CHANNEL_URL = (+ channelId: string,+ threadId?: string | null,+ projectId?: string | null,+) => {+ const path = projectId ? `/project/${projectId}/channels/${channelId}` : `/channels/${channelId}`;+ return threadId ? `${path}?thread=${encodeURIComponent(threadId)}` : path;+};+export const LIBRARY_URL = (id: string) => urlJoin('/resource/library', id);// Fixed product imagery is mirrored to the static origin; /app-images belongs to the App.diff --git a/packages/locales/src/default/notification.ts b/packages/locales/src/default/notification.tsindex 8cae2896a01..c24e94f45c1 100644--- a/packages/locales/src/default/notification.ts+++ b/packages/locales/src/default/notification.ts@@ -116,6 +116,8 @@ export default {'document_comment_activity_thread_title': 'New reply in your comment thread','document_comment_mentioned': '{{actorLabel}} mentioned you in a comment on "{{documentTitle}}".','document_comment_mentioned_title': 'You were mentioned in a document comment',+ 'channel_mentioned': '{{actorLabel}} mentioned you in the channel "{{channelTitle}}".',+ 'channel_mentioned_title': 'You were mentioned in a channel','document_mentioned': '{{actorLabel}} mentioned you in "{{documentTitle}}".','document_mentioned_title': 'You were mentioned in a document','document_liked': '{{actorLabel}} liked your document "{{documentTitle}}".',diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex 9bb13a4d31c..d69e4739bdc 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -1081,6 +1081,7 @@ export default {'notification.item.agent_task_run_failed': 'Task failed','notification.item.agent_run_completed': 'Agent task completed','notification.item.agent_transfer_result': 'Transfer request result',+ 'notification.item.channel_mentioned': 'Mentioned in a channel','notification.item.checkout_abandoned': 'Unfinished checkout reminders','notification.item.credit_balance_low': 'Balance running low','notification.item.image_generation_completed': 'Image generation completed',diff --git a/src/business/server/channel-mention/notifyActivity.ts b/src/business/server/channel-mention/notifyActivity.tsnew file mode 100644index 00000000000..546c24ea090--- /dev/null+++ b/src/business/server/channel-mention/notifyActivity.ts@@ -0,0 +1,15 @@+/**+ * Workspace members were @-mentioned in a Channel message. Fired once per sent+ * message; the caller has already narrowed recipients to mentioned people who are+ * active members of both the Channel and its workspace, other than the sender.+ */+export interface NotifyChannelMentionParams {+ actorUserId: string;+ channelId: string;+ messageId: string;+ recipientUserIds: string[];+ workspaceId: string;+}++export const notifyChannelMention = (_params: NotifyChannelMentionParams): Promise<void> =>+ Promise.resolve();diff --git a/src/features/Channels/ChannelList.tsx b/src/features/Channels/ChannelList.tsxindex 54d57987dbd..77de170bdec 100644--- a/src/features/Channels/ChannelList.tsx+++ b/src/features/Channels/ChannelList.tsx@@ -1,3 +1,4 @@+import { CHANNEL_URL } from '@lobechat/const';import type { ChannelListItem } from '@lobechat/types';import {AccordionHeader,@@ -30,7 +31,7 @@ import { channelActions, channelSelectors, useChannelStore } from '@/store/channimport { channelsInScope } from './channelScope';import { openCreateChannel } from './CreateChannel';-import { channelPath, matchChannel } from './paths';+import { matchChannel } from './paths';import { threadTitle } from './threadTitle';import { useChannelEvents } from './useChannelEvents';import { useChannelMenu } from './useChannelMenu';@@ -101,7 +102,7 @@ const ChannelThreads = ({return (<Flexbox aria-label={t('thread')} gap={1} paddingBlock={1}>{shown.map(({ thread, index }, position) => {- const path = channelPath(channelId, thread.id, projectId);+ const path = CHANNEL_URL(channelId, thread.id, projectId);const active = thread.id === threadId;const items = threadMenu(detail.channel, thread);return (@@ -171,12 +172,12 @@ const EnabledChannelSection = ({ itemKey = 'channels', projectId }: ChannelSecticonst [showArchived, setShowArchived] = useState(false);const activeChannelId = matchChannel(pathname);const create = () =>- openCreateChannel((id) => navigate(channelPath(id, null, projectId)), projectId);+ openCreateChannel((id) => navigate(CHANNEL_URL(id, null, projectId)), projectId);const activeThreadId = new URLSearchParams(search).get('thread');const menuItems = useChannelMenu();const renderChannel = (channel: ChannelListItem) => {- const path = channelPath(channel.id, null, channel.projectId);+ const path = CHANNEL_URL(channel.id, null, channel.projectId);const open = activeChannelId === channel.id;return (<Flexbox key={channel.id}>diff --git a/src/features/Channels/MemberStatus.tsx b/src/features/Channels/MemberStatus.tsxindex 5fd63095426..e3b519227db 100644--- a/src/features/Channels/MemberStatus.tsx+++ b/src/features/Channels/MemberStatus.tsx@@ -1,3 +1,4 @@+import { CHANNEL_URL } from '@lobechat/const';import type { ChannelDetail } from '@lobechat/types';import { ActionIcon, Button, Flexbox, Popover, Text } from '@lobehub/ui';import * as stylex from '@stylexjs/stylex';@@ -12,7 +13,6 @@ import { canInviteMembers } from './channelAccess';import { openInviteMembers } from './CreateChannel';import { FailureIndicator } from './FailureIndicator';import { MemberList, StatusAvatar, useMemberEntries } from './MemberList';-import { channelPath } from './paths';import { statusStyles, styles } from './styles';/** Header avatars before the rest fold into a count; the list shows everyone. */@@ -100,7 +100,7 @@ export function MemberStatus({workspaceId: channel.workspaceId,},// Inviting from a direct conversation opens the group it starts.- (id) => navigate(channelPath(id)),+ (id) => navigate(CHANNEL_URL(id)),)}/>diff --git a/src/features/Channels/paths.test.ts b/src/features/Channels/paths.test.tsindex 38249d4f0be..4b6dd814041 100644--- a/src/features/Channels/paths.test.ts+++ b/src/features/Channels/paths.test.ts@@ -1,20 +1,6 @@import { describe, expect, it } from 'vitest';-import { channelPath, matchChannel } from './paths';--describe('channelPath', () => {- it('builds the channel and thread paths', () => {- expect(channelPath('chn_1')).toBe('/channels/chn_1');- expect(channelPath('chn_1', 'cht_1')).toBe('/channels/chn_1?thread=cht_1');- });-- it('opens a project Channel inside its project', () => {- expect(channelPath('chn_1', null, 'pro_1')).toBe('/project/pro_1/channels/chn_1');- expect(channelPath('chn_1', 'cht_1', 'pro_1')).toBe(- '/project/pro_1/channels/chn_1?thread=cht_1',- );- });-});+import { matchChannel } from './paths';describe('matchChannel', () => {it.each([diff --git a/src/features/Channels/paths.ts b/src/features/Channels/paths.tsindex 1b300d53daf..17970d181df 100644--- a/src/features/Channels/paths.ts+++ b/src/features/Channels/paths.ts@@ -1,16 +1,3 @@-/**- * A Channel page; a thread opens beside its Channel. A project's Channel opens inside the- * project so its sidebar stays in place.- */-export const channelPath = (- channelId: string,- threadId?: string | null,- projectId?: string | null,-) => {- const path = projectId ? `/project/${projectId}/channels/${channelId}` : `/channels/${channelId}`;- return threadId ? `${path}?thread=${encodeURIComponent(threadId)}` : path;-};-// An optional leading segment is the workspace slug, then an optional project scope.const CHANNEL_PATH = /^(?:\/[^/]+)?(?:\/project\/[^/]+)?\/channels\/([^/]+)\/?$/;