diff --git a/src/lib/components/channel/Channel.svelte b/src/lib/components/channel/Channel.svelte index d552ba89b0..0dec5fb9d0 100644 --- a/src/lib/components/channel/Channel.svelte +++ b/src/lib/components/channel/Channel.svelte @@ -3,6 +3,7 @@ import { onDestroy, onMount, tick } from 'svelte'; import { goto } from '$app/navigation'; + import { page } from '$app/stores'; import { v4 as uuidv4 } from 'uuid'; import { @@ -48,6 +49,11 @@ initHandler(); } + $: if (channel && $page.url.searchParams.get('thread')) { + threadId = $page.url.searchParams.get('thread'); + window.history.replaceState(history.state, '', `/channels/${id}`); + } + const scrollToBottom = () => { if (messagesContainerElement) { messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 43b5a40929..e121267223 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -864,7 +864,9 @@ toast.custom(NotificationToast, { componentProps: { onClick: () => { - goto(`/channels/${event.channel_id}`); + goto( + `/channels/${event.channel_id}${data?.parent_id ? `?thread=${data.parent_id}` : ''}` + ); }, content: data?.content, title: `${title}`