diff --git a/plugins/chunter-resources/src/components/ChannelScrollView.svelte b/plugins/chunter-resources/src/components/ChannelScrollView.svelte index 22647f1f68..8f01ca3a3a 100644 --- a/plugins/chunter-resources/src/components/ChannelScrollView.svelte +++ b/plugins/chunter-resources/src/components/ChannelScrollView.svelte @@ -364,10 +364,15 @@ } } - $: void initializeScroll($isLoadingStore, separatorElement, $newTimestampStore) + $: newTimestamp = $newTimestampStore + $: separatorIndex = + newTimestamp !== undefined + ? displayMessages.findIndex((message) => (message.createdOn ?? 0) >= (newTimestamp ?? 0)) + : -1 + $: void initializeScroll($isLoadingStore, separatorElement, separatorIndex) let isInitialScrolling = true - async function initializeScroll (isLoading: boolean, separatorElement?: HTMLDivElement, newTimestamp?: Timestamp) { + async function initializeScroll (isLoading: boolean, separatorElement?: HTMLDivElement, separatorIndex?: number) { if (isLoading || isScrollInitialized) { return } @@ -379,7 +384,7 @@ await wait() scrollToMessage() isInitialScrolling = false - } else if (newTimestamp === undefined) { + } else if (separatorIndex === -1) { isScrollInitialized = true shouldWaitAndRead = true autoscroll = true @@ -564,10 +569,10 @@ {/if} - {#each displayMessages as message (message._id)} + {#each displayMessages as message, index (message._id)} {@const isSelected = message._id === selectedMessageId} - {#if message.createdOn === $newTimestampStore} + {#if separatorIndex === index} {/if} diff --git a/plugins/chunter-resources/src/components/ChannelView.svelte b/plugins/chunter-resources/src/components/ChannelView.svelte index 1f5b3dec96..2e2cffcc07 100644 --- a/plugins/chunter-resources/src/components/ChannelView.svelte +++ b/plugins/chunter-resources/src/components/ChannelView.svelte @@ -47,14 +47,10 @@ $: withAside = !embedded && !isThreadOpened && !hierarchy.isDerived(context.attachedToClass, chunter.class.DirectMessage) - function toChannel (object?: Doc) { + function toChannel (object?: Doc): Channel | undefined { return object as Channel | undefined } - function toChannelRef (ref: Ref) { - return ref as Ref - } - defineSeparators('aside', panelSeparators) @@ -87,13 +83,9 @@ {#if hierarchy.isDerived(context.attachedToClass, chunter.class.Channel)} - + {:else} - + {/if} diff --git a/plugins/chunter-resources/src/components/chat/ChannelAside.svelte b/plugins/chunter-resources/src/components/chat/ChannelAside.svelte index 941eae24e8..40fb0949a9 100644 --- a/plugins/chunter-resources/src/components/chat/ChannelAside.svelte +++ b/plugins/chunter-resources/src/components/chat/ChannelAside.svelte @@ -25,7 +25,6 @@ import DocAside from './DocAside.svelte' import { joinChannel, leaveChannel } from '../../utils' - export let _id: Ref export let _class: Ref> export let object: ChunterSpace | undefined @@ -116,7 +115,7 @@ } - + {#if object && creatorPersonRef} {#if object} - + + + {#each mixins as mixin} + {@const mixinKeys = getMixinKeys(mixin._id)} + {#if mixinKeys.length} + + {#each mixinKeys as key (typeof key === 'string' ? key : key.key)} + + {/each} + {/if} + {/each} + {/if} - -